X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Faliasesmodel.h;h=74a0cfd65bfce173e618a90b118c3fb9af8c71b9;hp=f10c8186feb8b46a4ff32529603113f63ed774ac;hb=4c740970699031a20315c7f5666d1f88c439f739;hpb=6579cd49c867ce3fb6c99127851a881ea82d1b1b diff --git a/src/qtui/settingspages/aliasesmodel.h b/src/qtui/settingspages/aliasesmodel.h index f10c8186..74a0cfd6 100644 --- a/src/qtui/settingspages/aliasesmodel.h +++ b/src/qtui/settingspages/aliasesmodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -24,7 +24,7 @@ #include #include -#include "aliasmanager.h" +#include "clientaliasmanager.h" class AliasesModel : public QAbstractItemModel { Q_OBJECT @@ -43,25 +43,27 @@ 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(); + void loadDefaults(); void removeAlias(int index); void revert(); void commit(); signals: void configChanged(bool); - void modelReady(); - + void modelReady(bool); + private: - AliasManager _aliasManager; - AliasManager _clonedAliasManager; + ClientAliasManager _clonedAliasManager; bool _configChanged; + bool _modelReady; const AliasManager &aliasManager() const; AliasManager &aliasManager(); @@ -69,7 +71,20 @@ private: private slots: void clientConnected(); + void clientDisconnected(); 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