diff --git a/saoriaccount.cpp b/saoriaccount.cpp index 24724a9..c1c62da 100644 --- a/saoriaccount.cpp +++ b/saoriaccount.cpp @@ -109,10 +109,11 @@ { // TODO max_id、since_id、limitの処理を追加すべし。 QUrl url = instance()->timelineUrl(timeline); + int limit = SaoriApplication::saori()->setting()->value(SAORI_SETTING_GETLIMIT,SAORI_SETTING_GETLIMIT_DEFAULT).toInt(); if (url.isEmpty()) return; QNetworkRequest request = createHearder(); QUrlQuery q = query; - q.addQueryItem("limit","10"); + q.addQueryItem("limit",QString::number(limit)); request.setUrl(instance()->addQuery(url,q)); auto *reply = SaoriApplication::saori()->manager->get(request); connect(reply,&QNetworkReply::finished,[=](){ diff --git a/saoriconfiguredialog.cpp b/saoriconfiguredialog.cpp index 50090c3..5666e95 100644 --- a/saoriconfiguredialog.cpp +++ b/saoriconfiguredialog.cpp @@ -26,15 +26,42 @@ #include "saoriconfiguredialog.h" #include "ui_saoriconfiguredialog.h" +#include +#include +#include +#include SaoriConfigureDialog::SaoriConfigureDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SaoriConfigureDialog) { ui->setupUi(this); + resetValue(); } SaoriConfigureDialog::~SaoriConfigureDialog() { delete ui; } + +void SaoriConfigureDialog::resetValue() +{ + ui->spinBox_limit->setValue(SaoriApplication::saori()->setting()->value(SAORI_SETTING_GETLIMIT,SAORI_SETTING_GETLIMIT_DEFAULT).toInt()); + ui->spinBox_reloadInterval->setValue(SaoriApplication::saori()->setting()->value(SAORI_SETTING_RELOADINT,SAORI_SETTING_RELOADINT_DEFAULT).toInt()); + ui->checkBox_nsfw->setChecked(SaoriApplication::saori()->setting()->value(SAORI_SETTING_NSFWBLUR,SAORI_SETTING_NSFWBLUR_DEFAULT).toBool()); +} + +void SaoriConfigureDialog::accept() +{ + SaoriApplication::saori()->setting()->setValue(SAORI_SETTING_GETLIMIT,ui->spinBox_limit->value()); + SaoriApplication::saori()->setting()->setValue(SAORI_SETTING_RELOADINT,ui->spinBox_reloadInterval->value()); + SaoriApplication::saori()->setting()->setValue(SAORI_SETTING_NSFWBLUR,ui->checkBox_nsfw->isChecked()); + + hide(); +} + +void SaoriConfigureDialog::reject() +{ + resetValue(); + hide(); +} diff --git a/saoriconfiguredialog.h b/saoriconfiguredialog.h index 92c5dfc..7c4669f 100644 --- a/saoriconfiguredialog.h +++ b/saoriconfiguredialog.h @@ -41,6 +41,11 @@ explicit SaoriConfigureDialog(QWidget *parent = 0); ~SaoriConfigureDialog(); +protected: + void resetValue(); + virtual void accept(); + virtual void reject(); + private: Ui::SaoriConfigureDialog *ui; }; diff --git a/saoriconfiguredialog.ui b/saoriconfiguredialog.ui index d36f254..f879109 100644 --- a/saoriconfiguredialog.ui +++ b/saoriconfiguredialog.ui @@ -32,7 +32,7 @@ - + @@ -42,7 +42,21 @@ - + + + + + + Blur NSFW image preview: + + + + + + + + + @@ -54,7 +68,7 @@ Qt::Horizontal - QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset + QDialogButtonBox::Cancel|QDialogButtonBox::Ok diff --git a/saoridef.h b/saoridef.h index 2d88f75..a9d84d0 100644 --- a/saoridef.h +++ b/saoridef.h @@ -46,4 +46,12 @@ #define SAORI_MASTODON_APIPATH_NOTIFICATION "/api/v1/notifications" #define SAORI_MASTODON_APIPATH_POST "/api/v1/statuses" +#define SAORI_SETTING_GETLIMIT "application/getlimit" +#define SAORI_SETTING_GETLIMIT_DEFAULT 10 +#define SAORI_SETTING_NSFWBLUR "application/nsfwblur" +#define SAORI_SETTING_NSFWBLUR_DEFAULT true +#define SAORI_SETTING_RELOADINT "application/reloadinterval" +#define SAORI_SETTING_RELOADINT_DEFAULT 5 + + #endif // SAORIDEF_H diff --git a/saoriviewentry.cpp b/saoriviewentry.cpp index f75b7ce..700cb57 100644 --- a/saoriviewentry.cpp +++ b/saoriviewentry.cpp @@ -27,6 +27,7 @@ #include "saoriviewentry.h" #include "saoriapplication.h" #include "saoricache.h" +#include "saoridef.h" #include #include #include @@ -121,7 +122,8 @@ image = image.scaledToWidth(200,Qt::SmoothTransformation); break; case 3: - image = image.scaledToWidth(10,Qt::SmoothTransformation); + if (SaoriApplication::saori()->setting()->value(SAORI_SETTING_NSFWBLUR,SAORI_SETTING_NSFWBLUR_DEFAULT).toBool()) + image = image.scaledToWidth(10,Qt::SmoothTransformation); image = image.scaledToWidth(200,Qt::SmoothTransformation); break; default: diff --git a/saoriwindow.cpp b/saoriwindow.cpp index 6a77c8a..72d6a20 100644 --- a/saoriwindow.cpp +++ b/saoriwindow.cpp @@ -38,6 +38,8 @@ ui(new Ui::SaoriWindow) { ui->setupUi(this); + m_configDialog = new SaoriConfigureDialog(); + m_configDialog->setModal(true); connect(ui->actionAdd_Account,&QAction::triggered,this,&SaoriWindow::openAccountDialog); updateTimelineList(); } @@ -45,6 +47,7 @@ SaoriWindow::~SaoriWindow() { delete ui; + delete m_configDialog; } QPair SaoriWindow::getTimelineTitle(const QString timeline) @@ -188,3 +191,10 @@ } return; } + +void SaoriWindow::on_actionConfigure_triggered() +{ + m_configDialog->show(); + m_configDialog->raise(); + m_configDialog->activateWindow(); +} diff --git a/saoriwindow.h b/saoriwindow.h index da84032..674c7a2 100644 --- a/saoriwindow.h +++ b/saoriwindow.h @@ -31,6 +31,7 @@ #include #include #include +#include "saoriconfiguredialog.h" namespace Ui { class SaoriWindow; @@ -56,12 +57,15 @@ void updateTimelineList(); protected: + SaoriConfigureDialog *m_configDialog; private slots: void on_timelineTree_itemDoubleClicked(QTreeWidgetItem *item, int); void on_actionTabbedView_mode_toggled(bool arg1); + void on_actionConfigure_triggered(); + private: Ui::SaoriWindow *ui; };