Commit fd18401d authored by Rachel Mant's avatar Rachel Mant Committed by Vlad Zahorodnii
Browse files

Introduced a new setting for the task switcher - OrderMinimizedMode - and...

Introduced a new setting for the task switcher - OrderMinimizedMode - and implemented the tabbox logic for it
parent 9e9e05f8
Pipeline #190820 passed with stage
in 12 minutes and 53 seconds
......@@ -28,6 +28,7 @@ void TestTabBoxConfig::testDefaultCtor()
QCOMPARE(config.clientDesktopMode(), TabBoxConfig::defaultDesktopMode());
QCOMPARE(config.clientActivitiesMode(), TabBoxConfig::defaultActivitiesMode());
QCOMPARE(config.clientApplicationsMode(), TabBoxConfig::defaultApplicationsMode());
QCOMPARE(config.orderMinimizedMode(), TabBoxConfig::defaultOrderMinimizedMode());
QCOMPARE(config.clientMinimizedMode(), TabBoxConfig::defaultMinimizedMode());
QCOMPARE(config.showDesktopMode(), TabBoxConfig::defaultShowDesktopMode());
QCOMPARE(config.clientMultiScreenMode(), TabBoxConfig::defaultMultiScreenMode());
......@@ -46,6 +47,7 @@ void TestTabBoxConfig::testAssignmentOperator()
config.setClientDesktopMode(TabBoxConfig::AllDesktopsClients);
config.setClientActivitiesMode(TabBoxConfig::AllActivitiesClients);
config.setClientApplicationsMode(TabBoxConfig::OneWindowPerApplication);
config.setOrderMinimizedMode(TabBoxConfig::GroupByMinimized);
config.setClientMinimizedMode(TabBoxConfig::ExcludeMinimizedClients);
config.setShowDesktopMode(TabBoxConfig::ShowDesktopClient);
config.setClientMultiScreenMode(TabBoxConfig::ExcludeCurrentScreenClients);
......@@ -61,6 +63,7 @@ void TestTabBoxConfig::testAssignmentOperator()
QCOMPARE(config2.clientDesktopMode(), TabBoxConfig::AllDesktopsClients);
QCOMPARE(config2.clientActivitiesMode(), TabBoxConfig::AllActivitiesClients);
QCOMPARE(config2.clientApplicationsMode(), TabBoxConfig::OneWindowPerApplication);
QCOMPARE(config2.orderMinimizedMode(), TabBoxConfig::GroupByMinimized);
QCOMPARE(config2.clientMinimizedMode(), TabBoxConfig::ExcludeMinimizedClients);
QCOMPARE(config2.showDesktopMode(), TabBoxConfig::ShowDesktopClient);
QCOMPARE(config2.clientMultiScreenMode(), TabBoxConfig::ExcludeCurrentScreenClients);
......
......@@ -57,6 +57,7 @@ KWinTabBoxConfigForm::KWinTabBoxConfigForm(TabboxType type, QWidget *parent)
connect(ui->hiddenWindows, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onFilterMinimization);
connect(ui->oneAppWindow, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onApplicationMode);
connect(ui->orderMinimized, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onOrderMinimizedMode);
connect(ui->showDesktop, &QAbstractButton::clicked, this, &KWinTabBoxConfigForm::onShowDesktopMode);
connect(ui->switchingModeCombo, qOverload<int>(&QComboBox::currentIndexChanged), this, &KWinTabBoxConfigForm::onSwitchingMode);
......@@ -146,6 +147,11 @@ int KWinTabBoxConfigForm::applicationMode() const
return ui->oneAppWindow->isChecked() ? TabBoxConfig::OneWindowPerApplication : TabBoxConfig::AllWindowsAllApplications;
}
int KWinTabBoxConfigForm::orderMinimizedMode() const
{
return ui->orderMinimized->isChecked() ? TabBoxConfig::GroupByMinimized : TabBoxConfig::NoGroupByMinimized;
}
int KWinTabBoxConfigForm::showDesktopMode() const
{
return ui->showDesktop->isChecked() ? TabBoxConfig::ShowDesktopClient : TabBoxConfig::DoNotShowDesktopClient;
......@@ -194,6 +200,11 @@ void KWinTabBoxConfigForm::setApplicationMode(TabBox::TabBoxConfig::ClientApplic
ui->oneAppWindow->setChecked(mode == TabBoxConfig::OneWindowPerApplication);
}
void KWinTabBoxConfigForm::setOrderMinimizedMode(TabBox::TabBoxConfig::OrderMinimizedMode mode)
{
ui->orderMinimized->setChecked(mode == TabBoxConfig::GroupByMinimized);
}
void KWinTabBoxConfigForm::setShowDesktopMode(TabBox::TabBoxConfig::ShowDesktopMode mode)
{
ui->showDesktop->setChecked(mode == TabBoxConfig::ShowDesktopClient);
......@@ -307,6 +318,11 @@ void KWinTabBoxConfigForm::setApplicationModeEnabled(bool enabled)
ui->oneAppWindow->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setOrderMinimizedModeEnabled(bool enabled)
{
ui->orderMinimized->setEnabled(enabled);
}
void KWinTabBoxConfigForm::setShowDesktopModeEnabled(bool enabled)
{
ui->showDesktop->setEnabled(enabled);
......@@ -355,6 +371,11 @@ void KWinTabBoxConfigForm::setApplicationModeDefaultIndicatorVisible(bool visibl
setDefaultIndicatorVisible(ui->oneAppWindow, visible);
}
void KWinTabBoxConfigForm::setOrderMinimizedDefaultIndicatorVisible(bool visible)
{
setDefaultIndicatorVisible(ui->orderMinimized, visible);
}
void KWinTabBoxConfigForm::setShowDesktopModeDefaultIndicatorVisible(bool visible)
{
setDefaultIndicatorVisible(ui->showDesktop, visible);
......@@ -403,6 +424,11 @@ void KWin::KWinTabBoxConfigForm::onApplicationMode()
Q_EMIT applicationModeChanged(applicationMode());
}
void KWinTabBoxConfigForm::onOrderMinimizedMode()
{
Q_EMIT orderMinimizedModeChanged(orderMinimizedMode());
}
void KWinTabBoxConfigForm::onShowDesktopMode()
{
Q_EMIT showDesktopModeChanged(showDesktopMode());
......
......@@ -52,6 +52,7 @@ public:
int filterActivities() const;
int filterMinimization() const;
int applicationMode() const;
int orderMinimizedMode() const;
int showDesktopMode() const;
int switchingMode() const;
QString layoutName() const;
......@@ -61,6 +62,7 @@ public:
void setFilterActivities(TabBox::TabBoxConfig::ClientActivitiesMode mode);
void setFilterMinimization(TabBox::TabBoxConfig::ClientMinimizedMode mode);
void setApplicationMode(TabBox::TabBoxConfig::ClientApplicationsMode mode);
void setOrderMinimizedMode(TabBox::TabBoxConfig::OrderMinimizedMode mode);
void setShowDesktopMode(TabBox::TabBoxConfig::ShowDesktopMode mode);
void setSwitchingModeChanged(TabBox::TabBoxConfig::ClientSwitchingMode mode);
void setLayoutName(const QString &layoutName);
......@@ -78,6 +80,7 @@ public:
void setFilterActivitiesEnabled(bool enabled);
void setFilterMinimizationEnabled(bool enabled);
void setApplicationModeEnabled(bool enabled);
void setOrderMinimizedModeEnabled(bool enabled);
void setShowDesktopModeEnabled(bool enabled);
void setSwitchingModeEnabled(bool enabled);
void setLayoutNameEnabled(bool enabled);
......@@ -87,6 +90,7 @@ public:
void setFilterActivitiesDefaultIndicatorVisible(bool visible);
void setFilterMinimizationDefaultIndicatorVisible(bool visible);
void setApplicationModeDefaultIndicatorVisible(bool visible);
void setOrderMinimizedDefaultIndicatorVisible(bool visible);
void setShowDesktopModeDefaultIndicatorVisible(bool visible);
void setSwitchingModeDefaultIndicatorVisible(bool visible);
void setLayoutNameDefaultIndicatorVisible(bool visible);
......@@ -97,6 +101,7 @@ Q_SIGNALS:
void filterActivitiesChanged(int value);
void filterMinimizationChanged(int value);
void applicationModeChanged(int value);
void orderMinimizedModeChanged(int value);
void showDesktopModeChanged(int value);
void switchingModeChanged(int value);
void layoutNameChanged(const QString &layoutName);
......@@ -109,6 +114,7 @@ private Q_SLOTS:
void onFilterActivites();
void onFilterMinimization();
void onApplicationMode();
void onOrderMinimizedMode();
void onShowDesktopMode();
void onSwitchingMode();
void onEffectCombo();
......
......@@ -16,6 +16,9 @@
<entry key="ApplicationsMode" type="Int">
<default code="true">TabBoxConfig::defaultApplicationsMode()</default>
</entry>
<entry key="OrderMinimizedMode" type="Int">
<default code="true">TabBoxConfig::defaultOrderMinimizedMode()</default>
</entry>
<entry key="MinimizedMode" type="Int">
<default code="true">TabBoxConfig::defaultMinimizedMode()</default>
</entry>
......
......@@ -195,6 +195,7 @@ void KWinTabBoxConfig::setEnabledUi(KWinTabBoxConfigForm *form, const TabBoxSett
form->setFilterActivitiesEnabled(!config->isActivitiesModeImmutable());
form->setFilterMinimizationEnabled(!config->isMinimizedModeImmutable());
form->setApplicationModeEnabled(!config->isApplicationsModeImmutable());
form->setOrderMinimizedModeEnabled(!config->isOrderMinimizedModeImmutable());
form->setShowDesktopModeEnabled(!config->isShowDesktopModeImmutable());
form->setSwitchingModeEnabled(!config->isSwitchingModeImmutable());
form->setLayoutNameEnabled(!config->isLayoutNameImmutable());
......@@ -209,6 +210,7 @@ void KWinTabBoxConfig::createConnections(KWinTabBoxConfigForm *form)
connect(form, &KWinTabBoxConfigForm::filterActivitiesChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, &KWinTabBoxConfigForm::filterMinimizationChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, &KWinTabBoxConfigForm::applicationModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, &KWinTabBoxConfigForm::orderMinimizedModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, &KWinTabBoxConfigForm::showDesktopModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, &KWinTabBoxConfigForm::switchingModeChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
connect(form, &KWinTabBoxConfigForm::layoutNameChanged, this, &KWinTabBoxConfig::updateUnmanagedState);
......@@ -246,6 +248,7 @@ bool KWinTabBoxConfig::updateUnmanagedIsNeedSave(const KWinTabBoxConfigForm *for
isNeedSave |= form->filterActivities() != config->activitiesMode();
isNeedSave |= form->filterMinimization() != config->minimizedMode();
isNeedSave |= form->applicationMode() != config->applicationsMode();
isNeedSave |= form->orderMinimizedMode() != config->orderMinimizedMode();
isNeedSave |= form->showDesktopMode() != config->showDesktopMode();
isNeedSave |= form->switchingMode() != config->switchingMode();
isNeedSave |= form->layoutName() != config->layoutName();
......@@ -261,6 +264,7 @@ bool KWinTabBoxConfig::updateUnmanagedIsDefault(KWinTabBoxConfigForm *form, cons
isDefault &= form->filterActivities() == config->defaultActivitiesModeValue();
isDefault &= form->filterMinimization() == config->defaultMinimizedModeValue();
isDefault &= form->applicationMode() == config->defaultApplicationsModeValue();
isDefault &= form->orderMinimizedMode() == config->defaultOrderMinimizedModeValue();
isDefault &= form->showDesktopMode() == config->defaultShowDesktopModeValue();
isDefault &= form->switchingMode() == config->defaultSwitchingModeValue();
isDefault &= form->layoutName() == config->defaultLayoutNameValue();
......@@ -275,6 +279,7 @@ void KWinTabBoxConfig::updateUiDefaultIndicator(bool visible, KWinTabBoxConfigFo
form->setFilterActivitiesDefaultIndicatorVisible(visible && form->filterActivities() != config->defaultActivitiesModeValue());
form->setFilterMinimizationDefaultIndicatorVisible(visible && form->filterMinimization() != config->defaultMinimizedModeValue());
form->setApplicationModeDefaultIndicatorVisible(visible && form->applicationMode() != config->defaultApplicationsModeValue());
form->setOrderMinimizedDefaultIndicatorVisible(visible && form->orderMinimizedMode() != config->defaultOrderMinimizedModeValue());
form->setShowDesktopModeDefaultIndicatorVisible(visible && form->showDesktopMode() != config->defaultShowDesktopModeValue());
form->setSwitchingModeDefaultIndicatorVisible(visible && form->switchingMode() != config->defaultSwitchingModeValue());
form->setLayoutNameDefaultIndicatorVisible(visible && form->layoutName() != config->defaultLayoutNameValue());
......@@ -340,6 +345,7 @@ void KWinTabBoxConfig::updateUiFromConfig(KWinTabBoxConfigForm *form, const KWin
form->setFilterActivities(static_cast<TabBoxConfig::ClientActivitiesMode>(config->activitiesMode()));
form->setFilterMinimization(static_cast<TabBoxConfig::ClientMinimizedMode>(config->minimizedMode()));
form->setApplicationMode(static_cast<TabBoxConfig::ClientApplicationsMode>(config->applicationsMode()));
form->setOrderMinimizedMode(static_cast<TabBoxConfig::OrderMinimizedMode>(config->orderMinimizedMode()));
form->setShowDesktopMode(static_cast<TabBoxConfig::ShowDesktopMode>(config->showDesktopMode()));
form->setSwitchingModeChanged(static_cast<TabBoxConfig::ClientSwitchingMode>(config->switchingMode()));
form->setLayoutName(config->layoutName());
......@@ -352,6 +358,7 @@ void KWinTabBoxConfig::updateConfigFromUi(const KWinTabBoxConfigForm *form, TabB
config->setActivitiesMode(form->filterActivities());
config->setMinimizedMode(form->filterMinimization());
config->setApplicationsMode(form->applicationMode());
config->setOrderMinimizedMode(form->orderMinimizedMode());
config->setShowDesktopMode(form->showDesktopMode());
config->setSwitchingMode(form->switchingMode());
config->setLayoutName(form->layoutName());
......@@ -364,6 +371,7 @@ void KWinTabBoxConfig::updateUiFromDefaultConfig(KWinTabBoxConfigForm *form, con
form->setFilterActivities(static_cast<TabBoxConfig::ClientActivitiesMode>(config->defaultActivitiesModeValue()));
form->setFilterMinimization(static_cast<TabBoxConfig::ClientMinimizedMode>(config->defaultMinimizedModeValue()));
form->setApplicationMode(static_cast<TabBoxConfig::ClientApplicationsMode>(config->defaultApplicationsModeValue()));
form->setOrderMinimizedMode(static_cast<TabBoxConfig::OrderMinimizedMode>(config->defaultOrderMinimizedModeValue()));
form->setShowDesktopMode(static_cast<TabBoxConfig::ShowDesktopMode>(config->defaultShowDesktopModeValue()));
form->setSwitchingModeChanged(static_cast<TabBoxConfig::ClientSwitchingMode>(config->defaultSwitchingModeValue()));
form->setLayoutName(config->defaultLayoutNameValue());
......
......@@ -72,6 +72,16 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="orderMinimized">
<property name="text">
<string>Order minimized windows after unminimized windows</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
......
......@@ -235,6 +235,14 @@ void ClientModel::createClientList(int desktop, bool partialReset)
break;
}
}
if (tabBox->config().orderMinimizedMode() == TabBoxConfig::GroupByMinimized) {
// Put all non-minimized included clients first.
std::stable_partition(m_clientList.begin(), m_clientList.end(), [](const auto &client) {
return !client.toStrongRef()->isMinimized();
});
}
for (const QWeakPointer<TabBoxClient> &c : qAsConst(stickyClients)) {
m_clientList.removeAll(c);
m_clientList.prepend(c);
......
......@@ -465,6 +465,7 @@ TabBox::TabBox(QObject *parent)
m_defaultConfig.setClientDesktopMode(TabBoxConfig::OnlyCurrentDesktopClients);
m_defaultConfig.setClientActivitiesMode(TabBoxConfig::OnlyCurrentActivityClients);
m_defaultConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsAllApplications);
m_defaultConfig.setOrderMinimizedMode(TabBoxConfig::NoGroupByMinimized);
m_defaultConfig.setClientMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus);
m_defaultConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient);
m_defaultConfig.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen);
......@@ -475,6 +476,7 @@ TabBox::TabBox(QObject *parent)
m_alternativeConfig.setClientDesktopMode(TabBoxConfig::AllDesktopsClients);
m_alternativeConfig.setClientActivitiesMode(TabBoxConfig::OnlyCurrentActivityClients);
m_alternativeConfig.setClientApplicationsMode(TabBoxConfig::AllWindowsAllApplications);
m_alternativeConfig.setOrderMinimizedMode(TabBoxConfig::NoGroupByMinimized);
m_alternativeConfig.setClientMinimizedMode(TabBoxConfig::IgnoreMinimizedStatus);
m_alternativeConfig.setShowDesktopMode(TabBoxConfig::DoNotShowDesktopClient);
m_alternativeConfig.setClientMultiScreenMode(TabBoxConfig::IgnoreMultiScreen);
......@@ -817,6 +819,8 @@ void TabBox::loadConfig(const KConfigGroup &config, TabBoxConfig &tabBoxConfig)
config.readEntry<int>("ActivitiesMode", TabBoxConfig::defaultActivitiesMode())));
tabBoxConfig.setClientApplicationsMode(TabBoxConfig::ClientApplicationsMode(
config.readEntry<int>("ApplicationsMode", TabBoxConfig::defaultApplicationsMode())));
tabBoxConfig.setOrderMinimizedMode(TabBoxConfig::OrderMinimizedMode(
config.readEntry<int>("OrderMinimizedMode", TabBoxConfig::defaultOrderMinimizedMode())));
tabBoxConfig.setClientMinimizedMode(TabBoxConfig::ClientMinimizedMode(
config.readEntry<int>("MinimizedMode", TabBoxConfig::defaultMinimizedMode())));
tabBoxConfig.setShowDesktopMode(TabBoxConfig::ShowDesktopMode(
......
......@@ -23,6 +23,7 @@ public:
, clientDesktopMode(TabBoxConfig::defaultDesktopMode())
, clientActivitiesMode(TabBoxConfig::defaultActivitiesMode())
, clientApplicationsMode(TabBoxConfig::defaultApplicationsMode())
, orderMinimizedMode(TabBoxConfig::defaultOrderMinimizedMode())
, clientMinimizedMode(TabBoxConfig::defaultMinimizedMode())
, showDesktopMode(TabBoxConfig::defaultShowDesktopMode())
, clientMultiScreenMode(TabBoxConfig::defaultMultiScreenMode())
......@@ -41,6 +42,7 @@ public:
TabBoxConfig::ClientDesktopMode clientDesktopMode;
TabBoxConfig::ClientActivitiesMode clientActivitiesMode;
TabBoxConfig::ClientApplicationsMode clientApplicationsMode;
TabBoxConfig::OrderMinimizedMode orderMinimizedMode;
TabBoxConfig::ClientMinimizedMode clientMinimizedMode;
TabBoxConfig::ShowDesktopMode showDesktopMode;
TabBoxConfig::ClientMultiScreenMode clientMultiScreenMode;
......@@ -67,6 +69,7 @@ TabBoxConfig &TabBoxConfig::operator=(const KWin::TabBox::TabBoxConfig &object)
d->clientDesktopMode = object.clientDesktopMode();
d->clientActivitiesMode = object.clientActivitiesMode();
d->clientApplicationsMode = object.clientApplicationsMode();
d->orderMinimizedMode = object.orderMinimizedMode();
d->clientMinimizedMode = object.clientMinimizedMode();
d->showDesktopMode = object.showDesktopMode();
d->clientMultiScreenMode = object.clientMultiScreenMode();
......@@ -136,6 +139,16 @@ void TabBoxConfig::setClientApplicationsMode(ClientApplicationsMode applications
d->clientApplicationsMode = applicationsMode;
}
TabBoxConfig::OrderMinimizedMode TabBoxConfig::orderMinimizedMode() const
{
return d->orderMinimizedMode;
}
void TabBoxConfig::setOrderMinimizedMode(OrderMinimizedMode orderMinimizedMode)
{
d->orderMinimizedMode = orderMinimizedMode;
}
TabBoxConfig::ClientMinimizedMode TabBoxConfig::clientMinimizedMode() const
{
return d->clientMinimizedMode;
......
......@@ -84,6 +84,14 @@ public:
DoNotShowDesktopClient, ///< A TabBoxClient representing the desktop is not included
ShowDesktopClient ///< A TabBoxClient representing the desktop is included
};
/**
* OrderMinimizedMode defines whether the TabBoxClients considered part of the
* TabBoxClient List should be grouped by the minimisation status
*/
enum OrderMinimizedMode {
NoGroupByMinimized, ///< TabBoxClients are not grouped by whether they are minimized
GroupByMinimized ///< TabBoxClients are grouped by whether they are minimized or not
};
/**
* ClientActivitiesMode defines whether windows from the current activity or from all
* activities are included in the TabBoxClient List in the TabBoxClientModel
......@@ -162,6 +170,13 @@ public:
* @see defaultApplicationsMode
*/
ClientApplicationsMode clientApplicationsMode() const;
/**
* @return The current OrderMinimizedMode
* This option only applies for TabBoxMode ClientTabBox.
* @see setOrderMinimizedMode
* @see defaultOrderMinimizedMode
*/
OrderMinimizedMode orderMinimizedMode() const;
/**
* @return The current ClientMinimizedMode
* This option only applies for TabBoxMode ClientTabBox.
......@@ -238,6 +253,12 @@ public:
* @see clientApplicationsMode
*/
void setClientApplicationsMode(ClientApplicationsMode applicationsMode);
/**
* @param orderMinimizedMode The new OrderMinimizedMode to be used.
* This option only applies for TabBoxMode ClientTabBox.
* @see orderMinimizedMode
*/
void setOrderMinimizedMode(OrderMinimizedMode orderMinimizedMode);
/**
* @param minimizedMode The new ClientMinimizedMode to be used.
* This option only applies for TabBoxMode ClientTabBox.
......@@ -287,6 +308,10 @@ public:
{
return AllWindowsAllApplications;
}
static OrderMinimizedMode defaultOrderMinimizedMode()
{
return NoGroupByMinimized;
}
static ClientMinimizedMode defaultMinimizedMode()
{
return IgnoreMinimizedStatus;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment