mirror of
https://github.com/KDE/latte-dock.git
synced 2025-02-05 05:47:26 +03:00
enable global shortcuts for universal settings
This commit is contained in:
parent
d97a819bc1
commit
4212d57ca7
@ -450,15 +450,6 @@ void DockConfigView::hideConfigWindow()
|
||||
}
|
||||
}
|
||||
|
||||
void DockConfigView::showLatteConfigWindow()
|
||||
{
|
||||
auto *dockCorona = qobject_cast<DockCorona *>(m_dockView->corona());
|
||||
|
||||
if (dockCorona) {
|
||||
dockCorona->layoutManager()->showLatteConfigDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void DockConfigView::updateLaunchersForGroup(int groupInt)
|
||||
{
|
||||
Dock::LaunchersGroup group = (Dock::LaunchersGroup)groupInt;
|
||||
|
@ -74,7 +74,6 @@ public slots:
|
||||
Q_INVOKABLE void hideConfigWindow();
|
||||
Q_INVOKABLE void setSticker(bool blockFocusLost);
|
||||
Q_INVOKABLE void setVisibleWindow(bool visible);
|
||||
Q_INVOKABLE void showLatteConfigWindow();
|
||||
Q_INVOKABLE void syncGeometry();
|
||||
Q_INVOKABLE void updateLaunchersForGroup(int groupInt);
|
||||
|
||||
|
@ -2235,7 +2235,7 @@ void DockView::addContainmentActions(QMenu *desktopMenu, QEvent *event)
|
||||
QAction *editLayoutsAction = new QAction(i18n("Configure..."), layoutsMenu);
|
||||
|
||||
connect(editLayoutsAction, &QAction::triggered, this, [this, dockCorona] {
|
||||
dockCorona->layoutManager()->showLatteConfigDialog();
|
||||
dockCorona->layoutManager()->showLatteConfigDialog(Dock::LayoutPage);
|
||||
});
|
||||
|
||||
layoutsMenu->addAction(editLayoutsAction);
|
||||
|
@ -171,7 +171,7 @@ void GlobalShortcuts::init()
|
||||
|
||||
//show-hide the main dock in the primary screen
|
||||
QAction *showAction = generalActions->addAction(QStringLiteral("show latte dock"));
|
||||
showAction->setText(i18n("Show Latte Dock"));
|
||||
showAction->setText(i18n("Show Dock"));
|
||||
showAction->setShortcut(QKeySequence(Qt::META + '`'));
|
||||
KGlobalAccel::setGlobalShortcut(showAction, QKeySequence(Qt::META + '`'));
|
||||
connect(showAction, &QAction::triggered, this, [this]() {
|
||||
@ -187,14 +187,22 @@ void GlobalShortcuts::init()
|
||||
});
|
||||
|
||||
//show the layouts editor
|
||||
QAction *layoutsAction = generalActions->addAction(QStringLiteral("show latte settings"));
|
||||
layoutsAction->setText(i18n("Show Latte Settings Window"));
|
||||
layoutsAction->setShortcut(QKeySequence(Qt::META + Qt::Key_E));
|
||||
KGlobalAccel::setGlobalShortcut(layoutsAction, QKeySequence(Qt::META + Qt::Key_E));
|
||||
QAction *layoutsAction = generalActions->addAction(QStringLiteral("show layout settings"));
|
||||
layoutsAction->setText(i18n("Show Layout Settings"));
|
||||
layoutsAction->setShortcut(QKeySequence(Qt::META + Qt::Key_W));
|
||||
KGlobalAccel::setGlobalShortcut(layoutsAction, QKeySequence(Qt::META + Qt::Key_W));
|
||||
connect(layoutsAction, &QAction::triggered, this, [this]() {
|
||||
showLatteConfigDialog();
|
||||
m_corona->layoutManager()->showLatteConfigDialog(Dock::LayoutPage);
|
||||
});
|
||||
|
||||
//show the latter universal settings
|
||||
QAction *universalSettingsAction = generalActions->addAction(QStringLiteral("show latte universal settings"));
|
||||
universalSettingsAction->setText(i18n("Show Latte Settings"));
|
||||
universalSettingsAction->setShortcut(QKeySequence(Qt::META + Qt::Key_E));
|
||||
KGlobalAccel::setGlobalShortcut(universalSettingsAction, QKeySequence(Qt::META + Qt::Key_E));
|
||||
connect(universalSettingsAction, &QAction::triggered, this, [this]() {
|
||||
m_corona->layoutManager()->showLatteConfigDialog(Dock::PreferencesPage);
|
||||
});
|
||||
|
||||
KActionCollection *taskbarActions = new KActionCollection(m_corona);
|
||||
|
||||
@ -490,11 +498,6 @@ void GlobalShortcuts::showDock()
|
||||
}
|
||||
}
|
||||
|
||||
void GlobalShortcuts::showLatteConfigDialog()
|
||||
{
|
||||
m_corona->layoutManager()->showLatteConfigDialog();
|
||||
}
|
||||
|
||||
bool GlobalShortcuts::dockAtLowerScreenPriority(DockView *test, DockView *base)
|
||||
{
|
||||
if (!base || ! test) {
|
||||
|
@ -52,7 +52,6 @@ private:
|
||||
void activateTaskManagerEntry(int index, Qt::Key modifier);
|
||||
void showDock();
|
||||
void hideDock();
|
||||
void showLatteConfigDialog();
|
||||
void showSettings();
|
||||
|
||||
bool dockAtLowerEdgePriority(DockView *test, DockView *base);
|
||||
|
@ -183,6 +183,15 @@ QStringList LatteConfigDialog::availableActivities()
|
||||
return m_availableActivities;
|
||||
}
|
||||
|
||||
void LatteConfigDialog::setCurrentPage(Dock::LatteConfigPage page)
|
||||
{
|
||||
if (page == Dock::LayoutPage) {
|
||||
ui->tabWidget->setCurrentIndex(0);
|
||||
} else if (page == Dock::PreferencesPage) {
|
||||
ui->tabWidget->setCurrentIndex(1);
|
||||
}
|
||||
}
|
||||
|
||||
void LatteConfigDialog::on_newButton_clicked()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
LatteConfigDialog(QWidget *parent, DockCorona *corona);
|
||||
~LatteConfigDialog();
|
||||
|
||||
void setCurrentPage(Dock::LatteConfigPage page);
|
||||
|
||||
QStringList activities();
|
||||
QStringList availableActivities();
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutsTab">
|
||||
<attribute name="title">
|
||||
@ -102,7 +102,7 @@
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>true</bool>
|
||||
|
@ -1024,7 +1024,7 @@ bool LayoutManager::layoutIsAssigned(QString layoutName)
|
||||
return false;
|
||||
}
|
||||
|
||||
void LayoutManager::showLatteConfigDialog()
|
||||
void LayoutManager::showLatteConfigDialog(int page)
|
||||
{
|
||||
if (!m_latteConfigDialog) {
|
||||
m_latteConfigDialog = new LatteConfigDialog(nullptr, m_corona);
|
||||
@ -1037,6 +1037,9 @@ void LayoutManager::showLatteConfigDialog()
|
||||
m_latteConfigDialog->showNormal();
|
||||
}
|
||||
|
||||
Dock::LatteConfigPage configPage = static_cast<Dock::LatteConfigPage>(page);
|
||||
m_latteConfigDialog->setCurrentPage(configPage);
|
||||
|
||||
m_latteConfigDialog->activateWindow();
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void showAboutDialog();
|
||||
Q_INVOKABLE void showLatteConfigDialog();
|
||||
Q_INVOKABLE void showLatteConfigDialog(int page = Latte::Dock::LayoutPage);
|
||||
|
||||
//! switch to specified layout, default previousMemoryUsage means that it didnt change
|
||||
Q_INVOKABLE bool switchToLayout(QString layoutName, int previousMemoryUsage = -1);
|
||||
|
@ -124,6 +124,12 @@ public:
|
||||
HighSensitivity
|
||||
};
|
||||
Q_ENUM(MouseSensitivity)
|
||||
|
||||
enum LatteConfigPage {
|
||||
LayoutPage = 0,
|
||||
PreferencesPage
|
||||
};
|
||||
Q_ENUM(LatteConfigPage)
|
||||
};
|
||||
|
||||
}//end of namespace
|
||||
|
@ -217,7 +217,8 @@ FocusScope {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
|
||||
onClicked: dockConfig.showLatteConfigWindow()
|
||||
readonly property int preferencesPage: Latte.Dock.PreferencesPage
|
||||
onClicked: layoutManager.showLatteConfigDialog(preferencesPage)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user