X-Git-Url: https://git.quassel-irc.org/?a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Faliasesmodel.h;h=74a0cfd65bfce173e618a90b118c3fb9af8c71b9;hb=3efffa2c3f687b21c8040e9a7ee3830e8f539abf;hp=7f7490e43229cad4d72f5dc9d71a407b981015c3;hpb=7a44d67d565fe4f627e64b158a91a5978591c743;p=quassel.git diff --git a/src/qtui/settingspages/aliasesmodel.h b/src/qtui/settingspages/aliasesmodel.h index 7f7490e4..74a0cfd6 100644 --- a/src/qtui/settingspages/aliasesmodel.h +++ b/src/qtui/settingspages/aliasesmodel.h @@ -43,10 +43,11 @@ public: inline QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } - inline int rowCount(const QModelIndex &parent = QModelIndex()) const { Q_UNUSED(parent) return aliasManager().count(); } - inline int columnCount(const QModelIndex &parent = QModelIndex()) const { Q_UNUSED(parent) return 2; } + inline int rowCount(const QModelIndex &parent = QModelIndex()) const; + inline int columnCount(const QModelIndex &parent = QModelIndex()) const; inline bool configChanged() const { return _configChanged; } + inline bool isReady() const { return _modelReady; } public slots: void newAlias(); @@ -60,9 +61,9 @@ signals: void modelReady(bool); private: - ClientAliasManager _aliasManager; ClientAliasManager _clonedAliasManager; bool _configChanged; + bool _modelReady; const AliasManager &aliasManager() const; AliasManager &aliasManager(); @@ -74,4 +75,16 @@ private slots: void initDone(); }; +// Inlines +int AliasesModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); + return isReady() ? aliasManager().count() : 0; +} + +int AliasesModel::columnCount(const QModelIndex &parent) const { + Q_UNUSED(parent); + return isReady() ? 2 : 0; +} + + #endif //ALIASESMODEL_H