From 4782325c4a2a3df0b97a481fed799e2f5c9e5084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 9 Aug 2012 09:01:50 +0200 Subject: [PATCH] Remove outdated options from TabBoxConfig Since the QML port the LayoutMode had been hardcoded to vertical layout making it a completely useless code-path. MinWidth/Height are nowadays completely controlled by the QML theme. They were not read anywhere except in the kcm, but there not even bound to a ui element. The selectedItemLayoutName is also not used anymore with the new themes. --- kcmkwin/kwintabbox/main.cpp | 11 ------- tabbox/clientmodel.cpp | 30 ++--------------- tabbox/desktopmodel.cpp | 32 ++---------------- tabbox/tabbox.cpp | 4 --- tabbox/tabboxconfig.cpp | 54 +----------------------------- tabbox/tabboxconfig.h | 66 ------------------------------------- 6 files changed, 5 insertions(+), 192 deletions(-) diff --git a/kcmkwin/kwintabbox/main.cpp b/kcmkwin/kwintabbox/main.cpp index 5850416e3a..412af78108 100644 --- a/kcmkwin/kwintabbox/main.cpp +++ b/kcmkwin/kwintabbox/main.cpp @@ -267,18 +267,12 @@ void KWinTabBoxConfig::loadConfig(const KConfigGroup& config, KWin::TabBox::TabB config.readEntry("MultiScreenMode", TabBoxConfig::defaultMultiScreenMode()))); tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode( config.readEntry("SwitchingMode", TabBoxConfig::defaultSwitchingMode()))); - tabBoxConfig.setLayout(TabBoxConfig::LayoutMode( - config.readEntry("LayoutMode", TabBoxConfig::defaultLayoutMode()))); tabBoxConfig.setShowOutline(config.readEntry("ShowOutline", TabBoxConfig::defaultShowOutline())); tabBoxConfig.setShowTabBox(config.readEntry("ShowTabBox", TabBoxConfig::defaultShowTabBox())); tabBoxConfig.setHighlightWindows(config.readEntry("HighlightWindows", TabBoxConfig::defaultHighlightWindow())); - tabBoxConfig.setMinWidth(config.readEntry("MinWidth", TabBoxConfig::defaultMinWidth())); - tabBoxConfig.setMinHeight(config.readEntry("MinHeight", TabBoxConfig::defaultMinHeight())); - tabBoxConfig.setLayoutName(config.readEntry("LayoutName", TabBoxConfig::defaultLayoutName())); - tabBoxConfig.setSelectedItemLayoutName(config.readEntry("SelectedLayoutName", TabBoxConfig::defaultSelectedItemLayoutName())); } void KWinTabBoxConfig::saveConfig(KConfigGroup& config, const KWin::TabBox::TabBoxConfig& tabBoxConfig) @@ -291,18 +285,13 @@ void KWinTabBoxConfig::saveConfig(KConfigGroup& config, const KWin::TabBox::TabB config.writeEntry("ShowDesktopMode", int(tabBoxConfig.showDesktopMode())); config.writeEntry("MultiScreenMode", int(tabBoxConfig.clientMultiScreenMode())); config.writeEntry("SwitchingMode", int(tabBoxConfig.clientSwitchingMode())); - config.writeEntry("LayoutMode", int(tabBoxConfig.layout())); config.writeEntry("LayoutName", tabBoxConfig.layoutName()); - config.writeEntry("SelectedLayoutName", tabBoxConfig.selectedItemLayoutName()); // check boxes config.writeEntry("ShowOutline", tabBoxConfig.isShowOutline()); config.writeEntry("ShowTabBox", tabBoxConfig.isShowTabBox()); config.writeEntry("HighlightWindows", tabBoxConfig.isHighlightWindows()); - // spin boxes - config.writeEntry("MinWidth", tabBoxConfig.minWidth()); - config.writeEntry("MinHeight", tabBoxConfig.minHeight()); config.sync(); } diff --git a/tabbox/clientmodel.cpp b/tabbox/clientmodel.cpp index b78c1f5ce4..ddb0659a54 100644 --- a/tabbox/clientmodel.cpp +++ b/tabbox/clientmodel.cpp @@ -106,39 +106,13 @@ QString ClientModel::longestCaption() const int ClientModel::columnCount(const QModelIndex& parent) const { Q_UNUSED(parent) - int count = 1; - switch(tabBox->config().layout()) { - case TabBoxConfig::HorizontalLayout: - count = m_clientList.count(); - break; - case TabBoxConfig::VerticalLayout: - count = 1; - break; - case TabBoxConfig::HorizontalVerticalLayout: - count = qRound(sqrt(float(m_clientList.count()))); - if (count * count < m_clientList.count()) - count++; - break; - } - return qMax(count, 1); + return 1; } int ClientModel::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) - int count = 1; - switch(tabBox->config().layout()) { - case TabBoxConfig::HorizontalLayout: - count = 1; - break; - case TabBoxConfig::VerticalLayout: - count = m_clientList.count(); - break; - case TabBoxConfig::HorizontalVerticalLayout: - count = qRound(sqrt(float(m_clientList.count()))); - break; - } - return qMax(count, 1); + return m_clientList.count(); } QModelIndex ClientModel::parent(const QModelIndex& child) const diff --git a/tabbox/desktopmodel.cpp b/tabbox/desktopmodel.cpp index 0be873980b..0e43ce8e42 100644 --- a/tabbox/desktopmodel.cpp +++ b/tabbox/desktopmodel.cpp @@ -64,41 +64,13 @@ QVariant DesktopModel::data(const QModelIndex& index, int role) const int DesktopModel::columnCount(const QModelIndex& parent) const { Q_UNUSED(parent) - int count = 1; - switch(tabBox->config().layout()) { - case TabBoxConfig::HorizontalLayout: - count = m_desktopList.count(); - break; - case TabBoxConfig::VerticalLayout: - count = 1; - break; - case TabBoxConfig::HorizontalVerticalLayout: - count = qRound(sqrt(float(m_desktopList.count()))); - if (count * count < m_desktopList.count()) - count++; - // TODO: pager layout? - break; - } - return qMax(count, 1); + return 1; } int DesktopModel::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent) - int count = 1; - switch(tabBox->config().layout()) { - case TabBoxConfig::HorizontalLayout: - count = 1; - break; - case TabBoxConfig::VerticalLayout: - count = m_desktopList.count(); - break; - case TabBoxConfig::HorizontalVerticalLayout: - count = qRound(sqrt(float(m_desktopList.count()))); - // TODO: pager layout? - break; - } - return qMax(count, 1); + return m_desktopList.count(); } QModelIndex DesktopModel::parent(const QModelIndex& child) const diff --git a/tabbox/tabbox.cpp b/tabbox/tabbox.cpp index 098d7598c0..0c8fcb38cc 100644 --- a/tabbox/tabbox.cpp +++ b/tabbox/tabbox.cpp @@ -405,7 +405,6 @@ TabBox::TabBox(QObject *parent) m_defaultConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); m_defaultConfig.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen); m_defaultConfig.setClientSwitchingMode(TabBoxConfig::FocusChainSwitching); - m_defaultConfig.setLayout(TabBoxConfig::VerticalLayout); m_alternativeConfig = TabBoxConfig(); m_alternativeConfig.setTabBoxMode(TabBoxConfig::ClientTabBox); @@ -416,7 +415,6 @@ TabBox::TabBox(QObject *parent) m_alternativeConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); m_alternativeConfig.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen); m_alternativeConfig.setClientSwitchingMode(TabBoxConfig::FocusChainSwitching); - m_alternativeConfig.setLayout(TabBoxConfig::VerticalLayout); m_defaultCurrentApplicationConfig = m_defaultConfig; m_defaultCurrentApplicationConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsCurrentApplication); @@ -429,14 +427,12 @@ TabBox::TabBox(QObject *parent) m_desktopConfig.setShowTabBox(true); m_desktopConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); m_desktopConfig.setDesktopSwitchingMode(TabBoxConfig::MostRecentlyUsedDesktopSwitching); - m_desktopConfig.setLayout(TabBoxConfig::VerticalLayout); m_desktopListConfig = TabBoxConfig(); m_desktopListConfig.setTabBoxMode(TabBoxConfig::DesktopTabBox); m_desktopListConfig.setShowTabBox(true); m_desktopListConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient); m_desktopListConfig.setDesktopSwitchingMode(TabBoxConfig::StaticDesktopSwitching); - m_desktopListConfig.setLayout(TabBoxConfig::VerticalLayout); m_tabBox = new TabBoxHandlerImpl(this); QTimer::singleShot(0, this, SLOT(handlerReady())); connect(m_tabBox, SIGNAL(selectedIndexChanged()), SIGNAL(itemSelected())); diff --git a/tabbox/tabboxconfig.cpp b/tabbox/tabboxconfig.cpp index 42fdbcf398..1a851c9ed9 100644 --- a/tabbox/tabboxconfig.cpp +++ b/tabbox/tabboxconfig.cpp @@ -32,7 +32,6 @@ public: , highlightWindows(TabBoxConfig::defaultHighlightWindow()) , showOutline(TabBoxConfig::defaultShowOutline()) , tabBoxMode(TabBoxConfig::ClientTabBox) - , layout(TabBoxConfig::defaultLayoutMode()) , clientDesktopMode(TabBoxConfig::defaultDesktopMode()) , clientActivitiesMode(TabBoxConfig::defaultActivitiesMode()) , clientApplicationsMode(TabBoxConfig::defaultApplicationsMode()) @@ -41,10 +40,7 @@ public: , clientMultiScreenMode(TabBoxConfig::defaultMultiScreenMode()) , clientSwitchingMode(TabBoxConfig::defaultSwitchingMode()) , desktopSwitchingMode(TabBoxConfig::MostRecentlyUsedDesktopSwitching) - , minWidth(TabBoxConfig::defaultMinWidth()) - , minHeight(TabBoxConfig::defaultMinHeight()) - , layoutName(TabBoxConfig::defaultLayoutName()) - , selectedItemLayoutName(TabBoxConfig::defaultSelectedItemLayoutName()) { + , layoutName(TabBoxConfig::defaultLayoutName()) { } ~TabBoxConfigPrivate() { } @@ -53,7 +49,6 @@ public: bool showOutline; TabBoxConfig::TabBoxMode tabBoxMode; - TabBoxConfig::LayoutMode layout; TabBoxConfig::ClientDesktopMode clientDesktopMode; TabBoxConfig::ClientActivitiesMode clientActivitiesMode; TabBoxConfig::ClientApplicationsMode clientApplicationsMode; @@ -62,10 +57,7 @@ public: TabBoxConfig::ClientMultiScreenMode clientMultiScreenMode; TabBoxConfig::ClientSwitchingMode clientSwitchingMode; TabBoxConfig::DesktopSwitchingMode desktopSwitchingMode; - int minWidth; - int minHeight; QString layoutName; - QString selectedItemLayoutName; }; TabBoxConfig::TabBoxConfig() @@ -84,7 +76,6 @@ TabBoxConfig& TabBoxConfig::operator=(const KWin::TabBox::TabBoxConfig& object) d->highlightWindows = object.isHighlightWindows(); d->showOutline = object.isShowOutline(); d->tabBoxMode = object.tabBoxMode(); - d->layout = object.layout(); d->clientDesktopMode = object.clientDesktopMode(); d->clientActivitiesMode = object.clientActivitiesMode(); d->clientApplicationsMode = object.clientApplicationsMode(); @@ -92,9 +83,6 @@ TabBoxConfig& TabBoxConfig::operator=(const KWin::TabBox::TabBoxConfig& object) d->showDesktopMode = object.showDesktopMode(); d->clientMultiScreenMode = object.clientMultiScreenMode(); d->desktopSwitchingMode = object.desktopSwitchingMode(); - d->selectedItemLayoutName = object.selectedItemLayoutName(); - d->minWidth = object.minWidth(); - d->minHeight = object.minHeight(); d->layoutName = object.layoutName(); return *this; } @@ -139,16 +127,6 @@ TabBoxConfig::TabBoxMode TabBoxConfig::tabBoxMode() const return d->tabBoxMode; } -void TabBoxConfig::setLayout(TabBoxConfig::LayoutMode layout) -{ - d->layout = layout; -} - -TabBoxConfig::LayoutMode TabBoxConfig::layout() const -{ - return d->layout; -} - TabBoxConfig::ClientDesktopMode TabBoxConfig::clientDesktopMode() const { return d->clientDesktopMode; @@ -229,26 +207,6 @@ void TabBoxConfig::setDesktopSwitchingMode(DesktopSwitchingMode switchingMode) d->desktopSwitchingMode = switchingMode; } -int TabBoxConfig::minWidth() const -{ - return d->minWidth; -} - -void TabBoxConfig::setMinWidth(int value) -{ - d->minWidth = value; -} - -int TabBoxConfig::minHeight() const -{ - return d->minHeight; -} - -void TabBoxConfig::setMinHeight(int value) -{ - d->minHeight = value; -} - QString& TabBoxConfig::layoutName() const { return d->layoutName; @@ -259,15 +217,5 @@ void TabBoxConfig::setLayoutName(const QString& name) d->layoutName = name; } -QString& TabBoxConfig::selectedItemLayoutName() const -{ - return d->selectedItemLayoutName; -} - -void TabBoxConfig::setSelectedItemLayoutName(const QString& name) -{ - d->selectedItemLayoutName = name; -} - } // namespace TabBox } // namespace KWin diff --git a/tabbox/tabboxconfig.h b/tabbox/tabboxconfig.h index db02d232bb..83cdf9a572 100644 --- a/tabbox/tabboxconfig.h +++ b/tabbox/tabboxconfig.h @@ -51,15 +51,6 @@ class TabBoxConfigPrivate; class TabBoxConfig { public: - /** - * LayoutMode defines how the items will be displayed in the - * main TableView of the TabBox. - */ - enum LayoutMode { - VerticalLayout, ///< Items are laid out vertically - HorizontalLayout, ///< Items are laid out horizontally - HorizontalVerticalLayout ///< Items are laid out in a tabular. Number of columns might be greater by one than number of rows - }; /** * ClientDesktopMode defines whether windows from the current desktop or from all * desktops are included in the TabBoxClient List in the TabBoxClientModel @@ -169,12 +160,6 @@ public: */ TabBoxMode tabBoxMode() const; /** - * @return The currently used layout - * @see setLayout - * @see defaultLayoutMode - */ - LayoutMode layout() const; - /** * @return The current ClientDesktopMode * This option only applies for TabBoxMode ClientTabBox. * @see setClientDesktopMode @@ -230,29 +215,10 @@ public: */ DesktopSwitchingMode desktopSwitchingMode() const; /** - * @return The minimum width in percent of screen width the TabBox should use. - * @see setMinWidth - * @see minHeight - * @see defaultMinWidth - */ - int minWidth() const; - /** - * @return The minimum height in percent of screen height the TabBox should use. - * @see setMinHeight - * @see minWidth - * @see defaultMinHeight - */ - int minHeight() const; - /** * @return Then name of the current ItemLayout * @see setlayoutName */ QString& layoutName() const; - /** - * @return Then name of the current ItemLayout for selected Item view - * @see setlayoutName - */ - QString& selectedItemLayoutName() const; // setters /** @@ -279,11 +245,6 @@ public: */ void setTabBoxMode(TabBoxMode mode); /** - * @param layout The new LayoutMode to be used. - * @see layout - */ - void setLayout(LayoutMode layout); - /** * @param desktopMode The new ClientDesktopMode to be used. * This option only applies for TabBoxMode ClientTabBox. * @see clientDesktopMode @@ -332,25 +293,10 @@ public: */ void setDesktopSwitchingMode(DesktopSwitchingMode switchingMode); /** - * @param value The minimum width of TabBox in percent of screen width. - * @see minWidth - */ - void setMinWidth(int value); - /** - * @param value The minimum height of TabBox in percent of screen height. - * @see minHeight - */ - void setMinHeight(int value); - /** * @param name The new ItemLayout config name * @see layoutName */ void setLayoutName(const QString& name); - /** - * @param name The new ItemLayout config name for the selected item view - * @see selectedItemLayoutName - */ - void setSelectedItemLayoutName(const QString& name); // some static methods to access default values static ClientDesktopMode defaultDesktopMode() { @@ -374,9 +320,6 @@ public: static ClientSwitchingMode defaultSwitchingMode() { return FocusChainSwitching; } - static LayoutMode defaultLayoutMode() { - return VerticalLayout; - } static bool defaultShowTabBox() { return true; } @@ -386,18 +329,9 @@ public: static bool defaultHighlightWindow() { return true; } - static int defaultMinWidth() { - return 20; - } - static int defaultMinHeight() { - return 20; - } static QString defaultLayoutName() { return QString("thumbnails"); } - static QString defaultSelectedItemLayoutName() { - return QString("Text"); - } private: TabBoxConfigPrivate* d; };