X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchannellistdlg.h;h=285a11f53aaf3bd41e46525fe4d794fc64aacd2a;hp=dddd88e5008f81b59bf329c43387553415bba9fd;hb=cc6e7c08709c4e761e2fd9c2e322751015497003;hpb=02455427bfd88584a81f94b1b234fe21ad3e09cd diff --git a/src/qtui/channellistdlg.h b/src/qtui/channellistdlg.h index dddd88e5..285a11f5 100644 --- a/src/qtui/channellistdlg.h +++ b/src/qtui/channellistdlg.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-2019 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -15,54 +15,77 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef CHANNELLISTDLG_H #define CHANNELLISTDLG_H -#include "ui_channellistdlg.h" +#include #include "irclisthelper.h" #include "irclistmodel.h" #include "types.h" -#include +#include "ui_channellistdlg.h" class QSpacerItem; -class ChannelListDlg : public QDialog { - Q_OBJECT +class ChannelListDlg : public QDialog +{ + Q_OBJECT public: - ChannelListDlg(QWidget *parent = 0); + ChannelListDlg(QWidget* parent = nullptr); + + void setNetwork(NetworkId netId); - void setNetwork(NetworkId netId); + /** + * Set the channel search string, enabling advanced mode if needed + * + * Sets the channel name search text to the specified string, enabling advanced mode. If search + * string is empty, advanced mode will be automatically hidden. + * + * @param channelFilters Partial channel name to search for, or empty to not filter by name + */ + void setChannelFilters(const QString& channelFilters); + +public slots: + /** + * Request a channel listing using any parameters set in the UI + */ + void requestSearch(); protected slots: - void requestSearch(); - void receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList &channelList); - void reportFinishedList(); - void joinChannel(const QModelIndex &); + void receiveChannelList(const NetworkId& netId, + const QStringList& channelFilters, + const QList& channelList); + void reportFinishedList(); + void joinChannel(const QModelIndex&); private slots: - inline void toggleMode() { setAdvancedMode(!_advancedMode); } - void showError(const QString &error); + inline void toggleMode() { setAdvancedMode(!_advancedMode); } + void showError(const QString& error); private: - void showFilterLine(bool show); - void showErrors(bool show); - void enableQuery(bool enable); - void setAdvancedMode(bool advanced); - - Ui::ChannelListDlg ui; - - bool _listFinished; - NetworkId _netId; - IrcListModel _ircListModel; - QSortFilterProxyModel _sortFilter; - QSpacerItem *_simpleModeSpacer; - bool _advancedMode; + void showFilterLine(bool show); + void showErrors(bool show); + void enableQuery(bool enable); + void setAdvancedMode(bool advanced); + + /** + * Update the focus of input widgets according to dialog state + */ + void updateInputFocus(); + + Ui::ChannelListDlg ui; + + bool _listFinished{true}; + NetworkId _netId; + IrcListModel _ircListModel; + QSortFilterProxyModel _sortFilter; + QSpacerItem* _simpleModeSpacer{nullptr}; + bool _advancedMode{false}; }; -#endif //CHANNELLIST_H +#endif // CHANNELLIST_H