X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Fcoreaccountsettingspage.h;h=f28e01f083e60ef6f56988838f59a08b2de6ef94;hb=52cfbc8ee8f4da6f28c6afef089f8179434e717d;hp=e552a0b5cc6c00abf34b2bb69bdeee38c87ba7bc;hpb=11d59689fd6e1fe322a18b29c86d24d0803d6a2d;p=quassel.git diff --git a/src/qtui/settingspages/coreaccountsettingspage.h b/src/qtui/settingspages/coreaccountsettingspage.h index e552a0b5..f28e01f0 100644 --- a/src/qtui/settingspages/coreaccountsettingspage.h +++ b/src/qtui/settingspages/coreaccountsettingspage.h @@ -21,6 +21,8 @@ #ifndef COREACCOUNTSETTINGSPAGE_H_ #define COREACCOUNTSETTINGSPAGE_H_ +#include + #include "settingspage.h" #include "coreaccount.h" @@ -29,6 +31,7 @@ #include "ui_coreaccountsettingspage.h" class CoreAccountModel; +class FilteredCoreAccountModel; class CoreAccountSettingsPage : public SettingsPage { Q_OBJECT @@ -36,18 +39,29 @@ class CoreAccountSettingsPage : public SettingsPage { public: CoreAccountSettingsPage(QWidget *parent = 0); - virtual inline bool hasDefaults() const { return false; } + inline bool hasDefaults() const { return false; } + inline bool isStandAlone() const { return _standalone; } + + AccountId selectedAccount() const; public slots: void save(); void load(); + void setSelectedAccount(AccountId accId); + void setStandAlone(bool); + +signals: + void connectToCore(AccountId accId); + private slots: void on_addAccountButton_clicked(); void on_editAccountButton_clicked(); void on_deleteAccountButton_clicked(); + void on_accountView_doubleClicked(const QModelIndex &index); void setWidgetStates(); + void widgetHasChanged(); void rowsAboutToBeRemoved(const QModelIndex &index, int start, int end); void rowsInserted(const QModelIndex &index, int start, int end); @@ -57,13 +71,14 @@ class CoreAccountSettingsPage : public SettingsPage { CoreAccountModel *_model; inline CoreAccountModel *model() const { return _model; } + FilteredCoreAccountModel *_filteredModel; + inline FilteredCoreAccountModel *filteredModel() const { return _filteredModel; } AccountId _lastAccountId, _lastAutoConnectId; + bool _standalone; - virtual QVariant loadAutoWidgetValue(const QString &widgetName); - virtual void saveAutoWidgetValue(const QString &widgetName, const QVariant &value); + void editAccount(const QModelIndex &); - void widgetHasChanged(); bool testHasChanged(); inline QString settingsKey() const { return QString("CoreAccounts"); } @@ -92,4 +107,22 @@ private: CoreAccount _account; }; +// ======================================== +// FilteredCoreAccountModel +// ======================================== + +//! This filters out the internal account from the non-monolithic client's UI +class FilteredCoreAccountModel : public QSortFilterProxyModel { + Q_OBJECT + +public: + FilteredCoreAccountModel(CoreAccountModel *model, QObject *parent = 0); + +protected: + virtual bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const; + +private: + AccountId _internalAccount; +}; + #endif