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.
This commit is contained in:
Martin Gräßlin 2012-08-09 09:01:50 +02:00
parent d80113f376
commit 4782325c4a
6 changed files with 5 additions and 192 deletions

View file

@ -267,18 +267,12 @@ void KWinTabBoxConfig::loadConfig(const KConfigGroup& config, KWin::TabBox::TabB
config.readEntry<int>("MultiScreenMode", TabBoxConfig::defaultMultiScreenMode())));
tabBoxConfig.setClientSwitchingMode(TabBoxConfig::ClientSwitchingMode(
config.readEntry<int>("SwitchingMode", TabBoxConfig::defaultSwitchingMode())));
tabBoxConfig.setLayout(TabBoxConfig::LayoutMode(
config.readEntry<int>("LayoutMode", TabBoxConfig::defaultLayoutMode())));
tabBoxConfig.setShowOutline(config.readEntry<bool>("ShowOutline", TabBoxConfig::defaultShowOutline()));
tabBoxConfig.setShowTabBox(config.readEntry<bool>("ShowTabBox", TabBoxConfig::defaultShowTabBox()));
tabBoxConfig.setHighlightWindows(config.readEntry<bool>("HighlightWindows", TabBoxConfig::defaultHighlightWindow()));
tabBoxConfig.setMinWidth(config.readEntry<int>("MinWidth", TabBoxConfig::defaultMinWidth()));
tabBoxConfig.setMinHeight(config.readEntry<int>("MinHeight", TabBoxConfig::defaultMinHeight()));
tabBoxConfig.setLayoutName(config.readEntry<QString>("LayoutName", TabBoxConfig::defaultLayoutName()));
tabBoxConfig.setSelectedItemLayoutName(config.readEntry<QString>("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();
}

View file

@ -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

View file

@ -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

View file

@ -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()));

View file

@ -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

View file

@ -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;
};