diff --git a/saoriconfiguredialog.ui b/saoriconfiguredialog.ui index b81f241..1c13380 100644 --- a/saoriconfiguredialog.ui +++ b/saoriconfiguredialog.ui @@ -17,7 +17,7 @@ - 1 + 0 @@ -68,6 +68,20 @@ + + + + Minimize the window with the close button: + + + + + + + + + + diff --git a/saoridef.h b/saoridef.h index 0103252..afd2e3a 100644 --- a/saoridef.h +++ b/saoridef.h @@ -54,6 +54,10 @@ #define SAORI_SETTING_RELOADINT_DEFAULT 5 #define SAORI_SETTING_SHOWENTRIES "application/showentries" #define SAORI_SETTING_SHOWENTRIES_DEFAULT 100 +#define SAORI_SETTING_VIEW "application/view" +#define SAORI_SETTING_VIEW_PINED "/pined" +#define SAORI_SETTING_VIEW_GEOMETRY "/geometry" + #endif // SAORIDEF_H diff --git a/saoriview.cpp b/saoriview.cpp index 99c739e..08ccaf4 100644 --- a/saoriview.cpp +++ b/saoriview.cpp @@ -24,7 +24,6 @@ ***/ -#include "saoriview.h" #include "ui_saoriview.h" #include #include @@ -35,7 +34,9 @@ #include #include #include -#include +#include "saoriapplication.h" +#include "saoriview.h" +#include "saoridef.h" QList SaoriView::m_viewList; @@ -51,6 +52,11 @@ m_viewList.append(this); m_maxid = 0; + m_config = SAORI_SETTING_VIEW; + m_config += "/" + m_account + "/" + m_viewname; + ui->pushButton_pin->setChecked( + SaoriApplication::saori()->setting()->value(m_config + SAORI_SETTING_VIEW_PINED,false).toBool()); + ui->header->hide(); auto footter = new SaoriViewEntry(ui->scrollAreaWidgetContents); @@ -347,6 +353,16 @@ return QString("
"); } +void SaoriView::closeEvent(QCloseEvent *event) +{ + if (ui->pushButton_pin->isChecked()) { + SaoriApplication::saori()->setting()->setValue(m_config + SAORI_SETTING_VIEW_GEOMETRY, + qobject_cast(parent())->geometry()); + } + SaoriApplication::saori()->setting()->setValue(m_config + SAORI_SETTING_VIEW_PINED,ui->pushButton_pin->isChecked()); + QWidget::closeEvent(event); +} + void SaoriView::recived(const QString timeline,const QByteArray data) { if ((timeline.left(9) == "accounts:") && (m_viewname.left(9) == "accounts:")) { diff --git a/saoriview.h b/saoriview.h index e7279ec..ffdcdc4 100644 --- a/saoriview.h +++ b/saoriview.h @@ -50,6 +50,7 @@ protected: QString m_viewname; QString m_account; + QString m_config; QList m_entries; qlonglong m_maxid; @@ -71,6 +72,7 @@ static const QString htmlAnc(const QString link,const QString text); static const QString htmlHr(); + virtual void closeEvent(QCloseEvent *event); public slots: void recived(const QString timeline,const QByteArray data); diff --git a/saoriwindow.cpp b/saoriwindow.cpp index 5c9f280..511718a 100644 --- a/saoriwindow.cpp +++ b/saoriwindow.cpp @@ -27,6 +27,7 @@ #include #include #include +#include "saoridef.h" #include "saoriwindow.h" #include "ui_saoriwindow.h" #include "saoriapplication.h" @@ -103,6 +104,19 @@ connect(view,&SaoriView::openAccountView,this,&SaoriWindow::openAccountView); sub->setWindowTitle(title); sub->setWindowIcon(QIcon(getTimelineTitle(viewName.at(1)).second)); + + auto setting = SaoriApplication::saori()->setting(); + QString c = SAORI_SETTING_VIEW; + c += "/" + viewName.at(0) + "/" + viewName.at(1); + QRect defRect((ui->mdiArea->subWindowList().count() - 1) * 24, + (ui->mdiArea->subWindowList().count() - 1) * 24, + 450, + 600); + if (setting->value(c + SAORI_SETTING_VIEW_PINED,false).toBool()) { + sub->setGeometry(setting->value(c + SAORI_SETTING_VIEW_GEOMETRY,defRect).toRect()); + } else { + sub->setGeometry(defRect); + } sub->show(); } @@ -139,6 +153,9 @@ connect(view,&SaoriView::openAccountView,this,&SaoriWindow::openAccountView); sub->setWindowTitle(title); sub->setWindowIcon(QIcon(getTimelineTitle("accounts").second)); + sub->setGeometry(QRect((ui->mdiArea->subWindowList().count() - 1) * 24, + (ui->mdiArea->subWindowList().count() - 1) * 24, + 450,600)); sub->show(); } @@ -167,7 +184,6 @@ << SaoriApplication::getInstanceList()->at(i)->instance().toString()); item->setIcon(0,QIcon(":/icons/ionicons/earth.svg")); instanceItem->addChild(item); - //item->addChild(new QTreeWidgetItem(item,QStringList() << tr("Infomation"))); } } diff --git a/saoriwindow.h b/saoriwindow.h index 7db7886..bdfdda4 100644 --- a/saoriwindow.h +++ b/saoriwindow.h @@ -46,10 +46,8 @@ ~SaoriWindow(); static QPair getTimelineTitle(const QString timeline); -protected: - void openView(const QStringList viewName); - public slots: + void openView(const QStringList viewName); void openMediaView(const QUrl url); void openAccountView(const QStringList viewName); diff --git a/saoriwindow.ui b/saoriwindow.ui index 810e40b..47ad6e2 100644 --- a/saoriwindow.ui +++ b/saoriwindow.ui @@ -6,8 +6,8 @@ 0 0 - 768 - 628 + 1000 + 700 @@ -51,7 +51,7 @@ 0 0 - 768 + 1000 22