add shortcuts for layouts editor

pull/11/head
Michail Vourlakos 5 years ago
parent 7a11aa93c0
commit e9ec4ea266

@ -274,7 +274,7 @@ void Layouts::removeSelected()
void Layouts::toggleLockedForSelected()
{
if (m_view->currentIndex().row() < 0) {
if (!hasSelectedLayout()) {
return;
}
@ -285,7 +285,7 @@ void Layouts::toggleLockedForSelected()
void Layouts::toggleSharedForSelected()
{
if (m_view->currentIndex().row() < 0) {
if (!hasSelectedLayout()) {
return;
}

@ -126,7 +126,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
QAction *screensAction = fileMenu->addAction(i18n("Sc&reens..."));
screensAction->setIcon(QIcon::fromTheme("document-properties"));
screensAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
//screensAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_R));
QAction *quitAction = fileMenu->addAction(i18n("&Quit Latte"));
quitAction->setIcon(QIcon::fromTheme("application-exit"));
@ -134,8 +134,12 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
m_editLayoutAction = layoutMenu->addAction(i18nc("edit layout","&Edit..."));
m_editLayoutAction->setIcon(QIcon::fromTheme("document-edit"));
m_editLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
//m_editLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
m_editLayoutAction->setToolTip("You can edit layout file when layout is not active or locked");
m_editLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E));
ui->buttonBox->button(QDialogButtonBox::Apply)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
ui->buttonBox->button(QDialogButtonBox::Reset)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_L));
m_openUrlAction = new QAction(i18n("Open Location..."), this);
connect(m_openUrlAction, &QAction::triggered, this, [&]() {
@ -148,7 +152,7 @@ SettingsDialog::SettingsDialog(QWidget *parent, Latte::Corona *corona)
QAction *infoLayoutAction = layoutMenu->addAction(i18nc("layout information","&Information..."));
infoLayoutAction->setIcon(QIcon::fromTheme("document-properties"));
infoLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
//infoLayoutAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_I));
//! RTL support for labels in preferences
if (qApp->layoutDirection() == Qt::RightToLeft) {
@ -376,7 +380,6 @@ void SettingsDialog::on_importButton_clicked()
{
qDebug() << Q_FUNC_INFO;
QFileDialog *importFileDialog = new QFileDialog(this, i18nc("import layout/configuration", "Import Layout/Configuration")
, QDir::homePath()
, QStringLiteral("layout.latte"));
@ -465,7 +468,7 @@ void SettingsDialog::on_importButton_clicked()
void SettingsDialog::on_exportButton_clicked()
{
if (ui->layoutsView->currentIndex().row() < 0) {
if (!m_layoutsController->hasSelectedLayout()) {
return;
}
@ -597,6 +600,10 @@ void SettingsDialog::apply()
{
qDebug() << Q_FUNC_INFO;
if (!ui->buttonBox->button(QDialogButtonBox::Apply)->isEnabled()) {
return;
}
saveAllChanges();
updateApplyButtonsState();
@ -605,6 +612,12 @@ void SettingsDialog::apply()
void SettingsDialog::reset()
{
qDebug() << Q_FUNC_INFO;
if (!ui->buttonBox->button(QDialogButtonBox::Reset)->isEnabled()) {
return;
}
if (ui->tabWidget->currentIndex() == Latte::Types::LayoutPage) {
m_layoutsController->reset();
}

@ -84,14 +84,15 @@ private slots:
void on_newButton_clicked();
void on_copyButton_clicked();
void on_downloadButton_clicked();
void on_lockedButton_clicked();
void on_pauseButton_clicked();
void on_removeButton_clicked();
void on_sharedButton_clicked();
void on_switchButton_clicked();
void on_importButton_clicked();
void on_exportButton_clicked();
void on_lockedButton_clicked();
void on_sharedButton_clicked();
void accept() override;
void apply();

@ -145,12 +145,15 @@
<string>Switch to selected layout</string>
</property>
<property name="text">
<string comment="switch to layout">Switch</string>
<string comment="switch to layout">&amp;Switch</string>
</property>
<property name="icon">
<iconset theme="user-identity">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string>Ctrl+Tab</string>
</property>
</widget>
</item>
<item>
@ -159,12 +162,15 @@
<string>Pause all activities from the selected layout</string>
</property>
<property name="text">
<string>Pause</string>
<string>&amp;Pause</string>
</property>
<property name="icon">
<iconset theme="media-playback-pause">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string>Ctrl+P</string>
</property>
</widget>
</item>
<item>
@ -218,12 +224,15 @@
<string>New layout</string>
</property>
<property name="text">
<string comment="new layout">New</string>
<string comment="new layout">&amp;New</string>
</property>
<property name="icon">
<iconset theme="add">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string>Ctrl+N</string>
</property>
</widget>
</item>
<item>
@ -232,12 +241,15 @@
<string>Copy selected layout</string>
</property>
<property name="text">
<string comment="copy layout">Copy</string>
<string comment="copy layout">&amp;Copy</string>
</property>
<property name="icon">
<iconset theme="edit-copy">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string>Ctrl+C</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
@ -279,12 +291,15 @@
<string>Lock layout and make it read-only</string>
</property>
<property name="text">
<string comment="locked layout">Locked</string>
<string comment="locked layout">&amp;Locked</string>
</property>
<property name="icon">
<iconset theme="object-locked">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string>Meta+Shift+L</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@ -296,12 +311,15 @@
<string>Share that layout with other central layouts</string>
</property>
<property name="text">
<string>Shared</string>
<string>Sha&amp;red</string>
</property>
<property name="icon">
<iconset theme="document-share">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string>Ctrl+R</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
@ -373,12 +391,15 @@
<string>Import a layout or full configuration file</string>
</property>
<property name="text">
<string comment="import layout">Import</string>
<string comment="import layout">&amp;Import</string>
</property>
<property name="icon">
<iconset theme="document-import">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string/>
</property>
<property name="default">
<bool>false</bool>
</property>
@ -390,12 +411,18 @@
<string>Export selected layout or full configuration into a file</string>
</property>
<property name="text">
<string comment="export layout">Export</string>
<string comment="export layout">E&amp;xport</string>
</property>
<property name="icon">
<iconset theme="document-export">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string>Ctrl+Shift+X</string>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
<item>
@ -404,12 +431,15 @@
<string>Download community layouts from the Internet</string>
</property>
<property name="text">
<string comment="download layout">Download</string>
<string comment="download layout">Do&amp;wnload</string>
</property>
<property name="icon">
<iconset theme="get-hot-new-stuff">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="shortcut">
<string>Ctrl+Shift+D</string>
</property>
</widget>
</item>
<item>
@ -470,8 +500,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>890</width>
<height>662</height>
<width>885</width>
<height>613</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">

Loading…
Cancel
Save