X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingspages%2Faliasesmodel.h;h=74a0cfd65bfce173e618a90b118c3fb9af8c71b9;hp=f689f7a77f6166e30a7f43ef0661949018ff5a6f;hb=a7cd976ca45c83fdc2c0ba1142443bc72157a2ee;hpb=f7eb3911860f30e6bccce3c77d03fc25e87d7f93 diff --git a/src/qtui/settingspages/aliasesmodel.h b/src/qtui/settingspages/aliasesmodel.h index f689f7a7..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,13 +43,15 @@ 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(); @@ -57,11 +59,11 @@ public slots: signals: void configChanged(bool); void modelReady(bool); - + private: - AliasManager _aliasManager; - AliasManager _clonedAliasManager; + ClientAliasManager _clonedAliasManager; bool _configChanged; + bool _modelReady; const AliasManager &aliasManager() const; AliasManager &aliasManager(); @@ -73,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