X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fchannellistdlg.cpp;h=6cf58eb2a7c6de0937287b5e76b922761b26f0e2;hp=97d801bc8f1f37d5a744735cc0681d9251bb4ada;hb=c80ab2e825ff9125c1c7e8e829487a4b1c118579;hpb=c8e11a9292db37e0e0258537006e41c95c3f9ffe diff --git a/src/qtui/channellistdlg.cpp b/src/qtui/channellistdlg.cpp index 97d801bc..6cf58eb2 100644 --- a/src/qtui/channellistdlg.cpp +++ b/src/qtui/channellistdlg.cpp @@ -20,13 +20,15 @@ #include "channellistdlg.h" -#include "client.h" -#include "clientirclisthelper.h" - #include #include #include +#include "client.h" +#include "clientirclisthelper.h" +#include "icon.h" +#include "iconloader.h" + ChannelListDlg::ChannelListDlg(QWidget *parent) : QDialog(parent), _listFinished(true), @@ -38,8 +40,10 @@ ChannelListDlg::ChannelListDlg(QWidget *parent) _sortFilter.setSourceModel(&_ircListModel); _sortFilter.setFilterCaseSensitivity(Qt::CaseInsensitive); _sortFilter.setFilterKeyColumn(-1); - + ui.setupUi(this); + ui.advancedModeLabel->setPixmap(BarIcon("edit-rename")); + ui.channelListView->setSelectionBehavior(QAbstractItemView::SelectRows); ui.channelListView->setSelectionMode(QAbstractItemView::SingleSelection); ui.channelListView->setAlternatingRowColors(true); @@ -51,6 +55,8 @@ ChannelListDlg::ChannelListDlg(QWidget *parent) ui.searchChannelsButton->setAutoDefault(false); + setWindowIcon(Icon("format-list-unordered")); + connect(ui.advancedModeLabel, SIGNAL(clicked()), this, SLOT(toggleMode())); connect(ui.searchChannelsButton, SIGNAL(clicked()), this, SLOT(requestSearch())); connect(ui.channelNameLineEdit, SIGNAL(returnPressed()), this, SLOT(requestSearch())); @@ -70,7 +76,7 @@ ChannelListDlg::ChannelListDlg(QWidget *parent) void ChannelListDlg::setNetwork(NetworkId netId) { if(_netId == netId) return; - + _netId = netId; _ircListModel.setChannelList(); showFilterLine(false); @@ -86,8 +92,9 @@ void ChannelListDlg::requestSearch() { } void ChannelListDlg::receiveChannelList(const NetworkId &netId, const QStringList &channelFilters, const QList &channelList) { - Q_UNUSED(netId) Q_UNUSED(channelFilters) + if(netId != _netId) + return; showFilterLine(!channelList.isEmpty()); _ircListModel.setChannelList(channelList); @@ -108,42 +115,21 @@ void ChannelListDlg::enableQuery(bool enable) { void ChannelListDlg::setAdvancedMode(bool advanced) { _advancedMode = advanced; - QHBoxLayout *searchLayout = 0; -#if QT_VERSION >= 0x040400 - searchLayout = ui.searchLayout; -#else - // FIXME: REMOVE WHEN WE DEPEND ON Qt 4.4 - /* - * ok this just sucks: in Qt 4.3 there is no way to search for a layout as uic creates - * them without a parent -.- - * in this case there are only 2 candidates: ui.hboxLayout and ui.hboxLayout1 - */ - if(ui.hboxLayout.findWidget(ui.searchPatternLabel) != -1) - searchLayout = ui.hboxLayout; - else if(ui.hboxLayout1.findWidget(ui.searchPatternLabel) != -1) - searchLayout = ui.hboxLayout1; - else - /* if this assert trigger we have been compiled on a too old Qt - * or uic generated something very unexpected. we cannot find the layout to manipulate. - * Please upgrade to a recent version of Qt. - */ - Q_ASSERT(false); -#endif - if(advanced) { if(_simpleModeSpacer) { - searchLayout->removeItem(_simpleModeSpacer); + ui.searchLayout->removeItem(_simpleModeSpacer); delete _simpleModeSpacer; _simpleModeSpacer = 0; } - ui.advancedModeLabel->setPixmap(QPixmap(QString::fromUtf8(":/22x22/actions/oxygen/22x22/actions/edit-clear-locationbar-rtl.png"))); + ui.advancedModeLabel->setPixmap(BarIcon("edit-clear-locationbar-rtl")); } else { if(!_simpleModeSpacer) { _simpleModeSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); - searchLayout->insertSpacerItem(0, _simpleModeSpacer); + ui.searchLayout->insertSpacerItem(0, _simpleModeSpacer); } - ui.advancedModeLabel->setPixmap(QPixmap(QString::fromUtf8(":/22x22/actions/oxygen/22x22/actions/edit-clear.png"))); + ui.advancedModeLabel->setPixmap(BarIcon("edit-rename")); } + ui.channelNameLineEdit->clear(); ui.channelNameLineEdit->setVisible(advanced); ui.searchPatternLabel->setVisible(advanced);