mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-21 22:50:14 +03:00
introduce details button in settings window
This commit is contained in:
parent
1c6fb0a927
commit
1e9785dc0b
@ -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;
|
||||
|
@ -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<QAction *> actions = QList<QAction *>()) 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};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>930</width>
|
||||
<height>716</height>
|
||||
<width>966</width>
|
||||
<height>781</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -265,7 +265,7 @@
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>11</height>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -298,6 +298,48 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="detailsButton">
|
||||
<property name="text">
|
||||
<string>Details...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="view-list-details"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
@ -405,10 +447,13 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
@ -455,7 +500,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>895</width>
|
||||
<width>915</width>
|
||||
<height>375</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user