X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fsettingsdlg.cpp;h=5e9ea6ec631b634a310990e6176beca9f50c828b;hp=7d4134678219e3270e7a39d91b499bb9f9b405d8;hb=ddfb1d2574c4bffd180361a80df9b1cd584bb040;hpb=65c463f0154b12bbcd15d3b51ac231dd530fad3a diff --git a/src/qtui/settingsdlg.cpp b/src/qtui/settingsdlg.cpp index 7d413467..5e9ea6ec 100644 --- a/src/qtui/settingsdlg.cpp +++ b/src/qtui/settingsdlg.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2016 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,13 +18,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include +#include "settingsdlg.h" + #include #include -#include "settingsdlg.h" - #include "client.h" +#include "icon.h" SettingsDlg::SettingsDlg(QWidget *parent) : QDialog(parent), @@ -33,7 +33,7 @@ SettingsDlg::SettingsDlg(QWidget *parent) ui.setupUi(this); setModal(true); setAttribute(Qt::WA_DeleteOnClose, true); - setWindowIcon(QIcon::fromTheme("configure")); + setWindowIcon(icon::get("configure")); updateGeometry(); @@ -45,22 +45,6 @@ SettingsDlg::SettingsDlg(QWidget *parent) connect(Client::instance(), SIGNAL(coreConnectionStateChanged(bool)), SLOT(coreConnectionStateChanged())); setButtonStates(); - - // Some settings panes can take a good bit of space. To avoid squashing the settings tree, try - // to resize the dialog. If needed, it can always be resized by the user to take less space. - // - // Only try to resize if the sizes are valid. This shouldn't happen.. but better to be safe. - // See http://www.qtcentre.org/threads/3427-invalid-sizeHint() - if (ui.settingsTree->sizeHint().isValid() && ui.settingsTree->size().isValid()) { - // Find out how much width would make the settings tree happy - int wantedExtraWidth = ui.settingsTree->sizeHint().width() - - ui.settingsTree->size().width(); - // If more space is needed, try to resize to allow for it. Qt should keep the dialog within - // the bounds of the screen. - if (wantedExtraWidth > 0) { - this->resize(this->width() + wantedExtraWidth, this->height()); - } - } } @@ -81,7 +65,9 @@ void SettingsDlg::setItemState(QTreeWidgetItem *item) { SettingsPage *sp = qobject_cast(item->data(0, SettingsPageRole).value()); Q_ASSERT(sp); - item->setDisabled(!Client::isConnected() && sp->needsCoreConnection()); + bool disabledDueToConnection = !Client::isConnected() && sp->needsCoreConnection(); + bool disabledDueToOwnChoice = !sp->isSelectable(); + item->setDisabled(disabledDueToConnection || disabledDueToOwnChoice); } @@ -110,7 +96,6 @@ void SettingsDlg::registerSettingsPage(SettingsPage *sp) item = new QTreeWidgetItem(cat, QStringList(sp->title())); item->setData(0, SettingsPageRole, QVariant::fromValue(sp)); - ui.settingsTree->setMinimumWidth(ui.settingsTree->header()->sectionSizeHint(0) + 5); pageIsLoaded[sp] = false; if (!ui.settingsTree->selectedItems().count()) ui.settingsTree->setCurrentItem(item);