diff --git a/app/settings/handlers/tablayoutshandler.cpp b/app/settings/handlers/tablayoutshandler.cpp index 5626320d0..0a2667a83 100644 --- a/app/settings/handlers/tablayoutshandler.cpp +++ b/app/settings/handlers/tablayoutshandler.cpp @@ -59,8 +59,9 @@ TabLayouts::TabLayouts(Latte::SettingsDialog *parent) loadConfig(); m_layoutsController = new Settings::Controller::Layouts(this); - initUi(); + //! create menu and assign actions before initializing the user interface initLayoutMenu(); + initUi(); } TabLayouts::~TabLayouts() @@ -168,6 +169,13 @@ void TabLayouts::initLayoutMenu() connectActionWithButton(m_ui->sharedButton, m_sharedLayoutAction); connect(m_sharedLayoutAction, &QAction::triggered, this, &TabLayouts::on_shared_layout); + m_detailsAction = m_layoutMenu->addAction(i18nc("layout details", "De&tails...")); + m_detailsAction->setToolTip(i18n("Show selected layout details")); + m_detailsAction->setIcon(QIcon::fromTheme("view-list-details")); + m_detailsAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_T)); + connectActionWithButton(m_ui->detailsButton, m_detailsAction); + connect(m_detailsAction, &QAction::triggered, this, &TabLayouts::on_details_action); + m_layoutMenu->addSeparator(); m_importLayoutAction = m_layoutMenu->addAction(i18nc("import layout", "&Import...")); @@ -304,6 +312,23 @@ void TabLayouts::on_pause_layout() void TabLayouts::updatePerLayoutButtonsState() { + //! UI Elements that need to be enabled/disabled + + //! Shared Button - visible + if (m_layoutsController->inMultipleMode()) { + setTwinProperty(m_sharedLayoutAction, TWINVISIBLE, true); + } else { + setTwinProperty(m_sharedLayoutAction, TWINVISIBLE, false); + } + + //! Pause Button - visible + if (!m_layoutsController->inMultipleMode()) { + //! Single Layout mode + setTwinProperty(m_pauseLayoutAction, TWINVISIBLE, false); + } else { + setTwinProperty(m_pauseLayoutAction, TWINVISIBLE, true); + } + if (!m_layoutsController->hasSelectedLayout()) { return; } @@ -318,13 +343,8 @@ void TabLayouts::updatePerLayoutButtonsState() setTwinProperty(m_switchLayoutAction, TWINENABLED, true); } - //! Pause Button - if (!m_layoutsController->inMultipleMode()) { - //! Single Layout mode - setTwinProperty(m_pauseLayoutAction, TWINVISIBLE, false); - } else { - setTwinProperty(m_pauseLayoutAction, TWINVISIBLE, true); - + //! Pause Button - enabled + if (m_layoutsController->inMultipleMode()) { if (selectedLayout.isActive && !selectedLayout.isForFreeActivities() && !selectedLayout.isShared()) { @@ -348,19 +368,14 @@ void TabLayouts::updatePerLayoutButtonsState() setTwinProperty(m_lockedLayoutAction, TWINCHECKED, false); } - //! UI Elements that need to be enabled/disabled - if (m_layoutsController->inMultipleMode()) { - setTwinProperty(m_sharedLayoutAction, TWINVISIBLE, true); - } else { - setTwinProperty(m_sharedLayoutAction, TWINVISIBLE, false); - } - //! Layout Shared Button if (selectedLayout.isShared()) { setTwinProperty(m_sharedLayoutAction, TWINCHECKED, true); } else { setTwinProperty(m_sharedLayoutAction, TWINCHECKED, false); } + + setTwinProperty(m_detailsAction, TWINENABLED, true); } void TabLayouts::on_new_layout() @@ -639,6 +654,21 @@ void TabLayouts::on_export_layout() exportFileDialog->selectFile(selectedLayout.name); } +void TabLayouts::on_details_action() +{ + qDebug() << Q_FUNC_INFO; + + if (!isCurrentTab() || !m_exportLayoutAction->isEnabled()) { + return; + } + + if (!m_layoutsController->hasSelectedLayout()) { + return; + } + + Settings::Data::Layout selectedLayout = m_layoutsController->selectedLayoutCurrentData(); +} + void TabLayouts::on_layoutFilesDropped(const QStringList &paths) { QStringList layoutNames; diff --git a/app/settings/handlers/tablayoutshandler.h b/app/settings/handlers/tablayoutshandler.h index 55fc41df9..75e0f996a 100644 --- a/app/settings/handlers/tablayoutshandler.h +++ b/app/settings/handlers/tablayoutshandler.h @@ -74,8 +74,6 @@ public: Latte::SettingsDialog *dialog() const; Ui::SettingsDialog *ui() const; - - void showInlineMessage(const QString &msg, const KMessageWidget::MessageType &type, const int &hideInterval = 0, QList actions = QList()) override; public slots: @@ -102,6 +100,7 @@ private slots: void on_locked_layout(); void on_remove_layout(); void on_shared_layout(); + void on_details_action(); void on_currentPageChanged(int page); void on_layoutFilesDropped(const QStringList &paths); @@ -133,6 +132,7 @@ private: QAction *m_importLayoutAction{nullptr}; QAction *m_exportLayoutAction{nullptr}; QAction *m_downloadLayoutAction{nullptr}; + QAction *m_detailsAction{nullptr}; }; } diff --git a/app/settings/settingsdialog.ui b/app/settings/settingsdialog.ui index bae054084..db86289ee 100644 --- a/app/settings/settingsdialog.ui +++ b/app/settings/settingsdialog.ui @@ -6,8 +6,8 @@ 0 0 - 930 - 716 + 966 + 781 @@ -265,7 +265,7 @@ 1 - 11 + 10 @@ -298,6 +298,48 @@ + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 1 + 10 + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 20 + 15 + + + + + + + + Details... + + + + + + @@ -405,10 +447,13 @@ Qt::Vertical + + QSizePolicy::Preferred + 20 - 40 + 20 @@ -455,7 +500,7 @@ 0 0 - 895 + 915 375