improvements to new Latte config window

pull/2/head
Michail Vourlakos 7 years ago
parent 4da703fa9d
commit 8fb12bdbcf

@ -17,7 +17,7 @@ set(lattedock-app_SRCS
universalsettings.cpp universalsettings.cpp
layoutmanager.cpp layoutmanager.cpp
layout.cpp layout.cpp
layoutconfigdialog.cpp latteconfigdialog.cpp
importer.cpp importer.cpp
layoutsDelegates/checkboxdelegate.cpp layoutsDelegates/checkboxdelegate.cpp
layoutsDelegates/colorcmbboxdelegate.cpp layoutsDelegates/colorcmbboxdelegate.cpp
@ -30,7 +30,7 @@ set(lattedock-app_SRCS
set(latte_dbusXML dbus/org.kde.LatteDock.xml) set(latte_dbusXML dbus/org.kde.LatteDock.xml)
qt5_add_dbus_adaptor(lattedock-app_SRCS ${latte_dbusXML} dockcorona.h Latte::DockCorona lattedockadaptor) qt5_add_dbus_adaptor(lattedock-app_SRCS ${latte_dbusXML} dockcorona.h Latte::DockCorona lattedockadaptor)
ki18n_wrap_ui(lattedock-app_SRCS layoutconfigdialog.ui) ki18n_wrap_ui(lattedock-app_SRCS latteconfigdialog.ui)
add_executable(latte-dock ${lattedock-app_SRCS}) add_executable(latte-dock ${lattedock-app_SRCS})

@ -107,6 +107,7 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen, bool dockWindo
removeAction->setVisible(false); removeAction->setVisible(false);
QAction *configureAction = containment()->actions()->action("configure"); QAction *configureAction = containment()->actions()->action("configure");
configureAction->setShortcut(QKeySequence()); configureAction->setShortcut(QKeySequence());
configureAction->setText(i18nc("dock/panel settings window", "Dock/Panel Settings"));
//containment()->actions()->removeAction(removeAction); //containment()->actions()->removeAction(removeAction);
//FIX: hide and not delete in order to disable a nasty behavior from //FIX: hide and not delete in order to disable a nasty behavior from
//ContainmentInterface. If only one action exists for containment the //ContainmentInterface. If only one action exists for containment the
@ -2234,7 +2235,7 @@ void DockView::addContainmentActions(QMenu *desktopMenu, QEvent *event)
QAction *editLayoutsAction = new QAction(i18n("Configure..."), layoutsMenu); QAction *editLayoutsAction = new QAction(i18n("Configure..."), layoutsMenu);
connect(editLayoutsAction, &QAction::triggered, this, [this, dockCorona] { connect(editLayoutsAction, &QAction::triggered, this, [this, dockCorona] {
dockCorona->layoutManager()->showLayoutConfigDialog(); dockCorona->layoutManager()->showLatteConfigDialog();
}); });
layoutsMenu->addAction(editLayoutsAction); layoutsMenu->addAction(editLayoutsAction);

@ -179,20 +179,20 @@ void GlobalShortcuts::init()
}); });
//show-cycle between Latte settings windows //show-cycle between Latte settings windows
QAction *settingsAction = generalActions->addAction(QStringLiteral("show settings window")); QAction *settingsAction = generalActions->addAction(QStringLiteral("show dock settings"));
settingsAction->setText(i18n("Show Settings Window")); settingsAction->setText(i18n("Show Dock Settings"));
KGlobalAccel::setGlobalShortcut(settingsAction, QKeySequence(Qt::META + Qt::Key_A)); KGlobalAccel::setGlobalShortcut(settingsAction, QKeySequence(Qt::META + Qt::Key_A));
connect(settingsAction, &QAction::triggered, this, [this] { connect(settingsAction, &QAction::triggered, this, [this] {
showSettings(); showSettings();
}); });
//show the layouts editor //show the layouts editor
QAction *layoutsAction = generalActions->addAction(QStringLiteral("show layouts editor")); QAction *layoutsAction = generalActions->addAction(QStringLiteral("show latte settings"));
layoutsAction->setText(i18n("Show Layouts Editor")); layoutsAction->setText(i18n("Show Latte Settings Window"));
layoutsAction->setShortcut(QKeySequence(Qt::META + Qt::Key_E)); layoutsAction->setShortcut(QKeySequence(Qt::META + Qt::Key_E));
KGlobalAccel::setGlobalShortcut(layoutsAction, QKeySequence(Qt::META + Qt::Key_E)); KGlobalAccel::setGlobalShortcut(layoutsAction, QKeySequence(Qt::META + Qt::Key_E));
connect(layoutsAction, &QAction::triggered, this, [this]() { connect(layoutsAction, &QAction::triggered, this, [this]() {
showLayoutsEditor(); showLatteConfigDialog();
}); });
@ -490,9 +490,9 @@ void GlobalShortcuts::showDock()
} }
} }
void GlobalShortcuts::showLayoutsEditor() void GlobalShortcuts::showLatteConfigDialog()
{ {
m_corona->layoutManager()->showLayoutConfigDialog(); m_corona->layoutManager()->showLatteConfigDialog();
} }
bool GlobalShortcuts::dockAtLowerScreenPriority(DockView *test, DockView *base) bool GlobalShortcuts::dockAtLowerScreenPriority(DockView *test, DockView *base)

@ -52,7 +52,7 @@ private:
void activateTaskManagerEntry(int index, Qt::Key modifier); void activateTaskManagerEntry(int index, Qt::Key modifier);
void showDock(); void showDock();
void hideDock(); void hideDock();
void showLayoutsEditor(); void showLatteConfigDialog();
void showSettings(); void showSettings();
bool dockAtLowerEdgePriority(DockView *test, DockView *base); bool dockAtLowerEdgePriority(DockView *test, DockView *base);

@ -19,8 +19,8 @@
* *
*/ */
#include "ui_layoutconfigdialog.h" #include "ui_latteconfigdialog.h"
#include "layoutconfigdialog.h" #include "latteconfigdialog.h"
#include "layout.h" #include "layout.h"
#include "layoutsDelegates/checkboxdelegate.h" #include "layoutsDelegates/checkboxdelegate.h"
#include "layoutsDelegates/colorcmbboxdelegate.h" #include "layoutsDelegates/colorcmbboxdelegate.h"
@ -54,23 +54,21 @@ const int MENUCOLUMN = 3;
const int ACTIVITYCOLUMN = 4; const int ACTIVITYCOLUMN = 4;
const QChar CheckMark{0x2714}; const QChar CheckMark{0x2714};
LayoutConfigDialog::LayoutConfigDialog(QWidget *parent, LayoutManager *manager) LatteConfigDialog::LatteConfigDialog(QWidget *parent, LayoutManager *manager)
: QDialog(parent), : QDialog(parent),
ui(new Ui::LayoutConfigDialog), ui(new Ui::LatteConfigDialog),
m_manager(manager) m_manager(manager)
{ {
ui->setupUi(this); ui->setupUi(this);
setWindowTitle(i18n("Layouts Editor"));
setAttribute(Qt::WA_DeleteOnClose, true); setAttribute(Qt::WA_DeleteOnClose, true);
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
resize(m_manager->corona()->universalSettings()->layoutsWindowSize()); resize(m_manager->corona()->universalSettings()->layoutsWindowSize());
connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked
, this, &LayoutConfigDialog::apply); , this, &LatteConfigDialog::apply);
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked
, this, &LayoutConfigDialog::restoreDefaults); , this, &LatteConfigDialog::restoreDefaults);
m_model = new QStandardItemModel(manager->layouts().count(), 5, this); m_model = new QStandardItemModel(manager->layouts().count(), 5, this);
@ -82,8 +80,8 @@ LayoutConfigDialog::LayoutConfigDialog(QWidget *parent, LayoutManager *manager)
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
connect(m_manager, &LayoutManager::currentLayoutNameChanged, this, &LayoutConfigDialog::layoutsChanged); connect(m_manager, &LayoutManager::currentLayoutNameChanged, this, &LatteConfigDialog::layoutsChanged);
connect(m_manager, &LayoutManager::activeLayoutsChanged, this, &LayoutConfigDialog::layoutsChanged); connect(m_manager, &LayoutManager::activeLayoutsChanged, this, &LatteConfigDialog::layoutsChanged);
loadLayouts(); loadLayouts();
@ -111,8 +109,8 @@ LayoutConfigDialog::LayoutConfigDialog(QWidget *parent, LayoutManager *manager)
m_inMemoryButtons->addButton(ui->multipleToolBtn, Latte::Dock::MultipleLayouts); m_inMemoryButtons->addButton(ui->multipleToolBtn, Latte::Dock::MultipleLayouts);
m_inMemoryButtons->setExclusive(true); m_inMemoryButtons->setExclusive(true);
connect(m_model, &QStandardItemModel::itemChanged, this, &LayoutConfigDialog::itemChanged); connect(m_model, &QStandardItemModel::itemChanged, this, &LatteConfigDialog::itemChanged);
connect(ui->layoutsView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LayoutConfigDialog::currentRowChanged); connect(ui->layoutsView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &LatteConfigDialog::currentRowChanged);
connect(m_inMemoryButtons, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonPressed), connect(m_inMemoryButtons, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonPressed),
[ = ](QAbstractButton * button) { [ = ](QAbstractButton * button) {
@ -122,7 +120,7 @@ LayoutConfigDialog::LayoutConfigDialog(QWidget *parent, LayoutManager *manager)
} }
LayoutConfigDialog::~LayoutConfigDialog() LatteConfigDialog::~LatteConfigDialog()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@ -147,17 +145,17 @@ LayoutConfigDialog::~LayoutConfigDialog()
} }
} }
QStringList LayoutConfigDialog::activities() QStringList LatteConfigDialog::activities()
{ {
return m_manager->activities(); return m_manager->activities();
} }
QStringList LayoutConfigDialog::availableActivities() QStringList LatteConfigDialog::availableActivities()
{ {
return m_availableActivities; return m_availableActivities;
} }
void LayoutConfigDialog::on_newButton_clicked() void LatteConfigDialog::on_newButton_clicked()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@ -176,7 +174,7 @@ void LayoutConfigDialog::on_newButton_clicked()
} }
} }
void LayoutConfigDialog::on_copyButton_clicked() void LatteConfigDialog::on_copyButton_clicked()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@ -217,7 +215,7 @@ void LayoutConfigDialog::on_copyButton_clicked()
ui->layoutsView->selectRow(row + 1); ui->layoutsView->selectRow(row + 1);
} }
void LayoutConfigDialog::on_downloadButton_clicked() void LatteConfigDialog::on_downloadButton_clicked()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@ -245,7 +243,7 @@ void LayoutConfigDialog::on_downloadButton_clicked()
} }
} }
void LayoutConfigDialog::on_removeButton_clicked() void LatteConfigDialog::on_removeButton_clicked()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@ -272,7 +270,7 @@ void LayoutConfigDialog::on_removeButton_clicked()
ui->layoutsView->selectRow(row); ui->layoutsView->selectRow(row);
} }
void LayoutConfigDialog::on_importButton_clicked() void LatteConfigDialog::on_importButton_clicked()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@ -360,7 +358,7 @@ void LayoutConfigDialog::on_importButton_clicked()
fileDialog->open(); fileDialog->open();
} }
bool LayoutConfigDialog::importLayoutsFromV1ConfigFile(QString file) bool LatteConfigDialog::importLayoutsFromV1ConfigFile(QString file)
{ {
KTar archive(file, QStringLiteral("application/x-tar")); KTar archive(file, QStringLiteral("application/x-tar"));
archive.open(QIODevice::ReadOnly); archive.open(QIODevice::ReadOnly);
@ -399,7 +397,7 @@ bool LayoutConfigDialog::importLayoutsFromV1ConfigFile(QString file)
} }
void LayoutConfigDialog::on_exportButton_clicked() void LatteConfigDialog::on_exportButton_clicked()
{ {
int row = ui->layoutsView->currentIndex().row(); int row = ui->layoutsView->currentIndex().row();
@ -496,7 +494,7 @@ void LayoutConfigDialog::on_exportButton_clicked()
fileDialog->open(); fileDialog->open();
} }
void LayoutConfigDialog::accept() void LatteConfigDialog::accept()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@ -506,21 +504,21 @@ void LayoutConfigDialog::accept()
} }
} }
void LayoutConfigDialog::reject() void LatteConfigDialog::reject()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
deleteLater(); deleteLater();
} }
void LayoutConfigDialog::apply() void LatteConfigDialog::apply()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
saveAllChanges(); saveAllChanges();
updateButtonsState(); updateButtonsState();
} }
void LayoutConfigDialog::restoreDefaults() void LatteConfigDialog::restoreDefaults()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
@ -536,7 +534,7 @@ void LayoutConfigDialog::restoreDefaults()
} }
} }
void LayoutConfigDialog::addLayoutForFile(QString file, QString layoutName, bool newTempDirectory, bool showNotification) void LatteConfigDialog::addLayoutForFile(QString file, QString layoutName, bool newTempDirectory, bool showNotification)
{ {
if (layoutName.isEmpty()) { if (layoutName.isEmpty()) {
layoutName = Layout::layoutName(file); layoutName = Layout::layoutName(file);
@ -574,7 +572,7 @@ void LayoutConfigDialog::addLayoutForFile(QString file, QString layoutName, bool
} }
} }
void LayoutConfigDialog::loadLayouts() void LatteConfigDialog::loadLayouts()
{ {
m_initLayoutPaths.clear(); m_initLayoutPaths.clear();
m_model->clear(); m_model->clear();
@ -642,7 +640,7 @@ void LayoutConfigDialog::loadLayouts()
} }
} }
void LayoutConfigDialog::insertLayoutInfoAtRow(int row, QString path, QString color, QString name, bool menu, QStringList activities) void LatteConfigDialog::insertLayoutInfoAtRow(int row, QString path, QString color, QString name, bool menu, QStringList activities)
{ {
QStandardItem *pathItem = new QStandardItem(path); QStandardItem *pathItem = new QStandardItem(path);
@ -704,7 +702,7 @@ void LayoutConfigDialog::insertLayoutInfoAtRow(int row, QString path, QString co
} }
void LayoutConfigDialog::on_switchButton_clicked() void LatteConfigDialog::on_switchButton_clicked()
{ {
Latte::Dock::LayoutsMemoryUsage inMemoryOption = static_cast<Latte::Dock::LayoutsMemoryUsage>(m_inMemoryButtons->checkedId()); Latte::Dock::LayoutsMemoryUsage inMemoryOption = static_cast<Latte::Dock::LayoutsMemoryUsage>(m_inMemoryButtons->checkedId());
@ -721,7 +719,7 @@ void LayoutConfigDialog::on_switchButton_clicked()
} }
} }
void LayoutConfigDialog::layoutsChanged() void LatteConfigDialog::layoutsChanged()
{ {
for (int i = 0; i < m_model->rowCount(); ++i) { for (int i = 0; i < m_model->rowCount(); ++i) {
QModelIndex nameIndex = m_model->index(i, NAMECOLUMN); QModelIndex nameIndex = m_model->index(i, NAMECOLUMN);
@ -749,7 +747,7 @@ void LayoutConfigDialog::layoutsChanged()
} }
} }
void LayoutConfigDialog::itemChanged(QStandardItem *item) void LatteConfigDialog::itemChanged(QStandardItem *item)
{ {
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true); ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true);
@ -760,12 +758,12 @@ void LayoutConfigDialog::itemChanged(QStandardItem *item)
} }
} }
void LayoutConfigDialog::currentRowChanged(const QModelIndex &current, const QModelIndex &previous) void LatteConfigDialog::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
{ {
updateButtonsState(); updateButtonsState();
} }
void LayoutConfigDialog::updateButtonsState() void LatteConfigDialog::updateButtonsState()
{ {
QString id = m_model->data(m_model->index(ui->layoutsView->currentIndex().row(), IDCOLUMN), Qt::DisplayRole).toString(); QString id = m_model->data(m_model->index(ui->layoutsView->currentIndex().row(), IDCOLUMN), Qt::DisplayRole).toString();
QString name = m_layouts[id]->name(); QString name = m_layouts[id]->name();
@ -783,7 +781,7 @@ void LayoutConfigDialog::updateButtonsState()
} }
} }
void LayoutConfigDialog::recalculateAvailableActivities() void LatteConfigDialog::recalculateAvailableActivities()
{ {
QStringList tempActivities = m_manager->activities(); QStringList tempActivities = m_manager->activities();
@ -800,7 +798,7 @@ void LayoutConfigDialog::recalculateAvailableActivities()
m_availableActivities = tempActivities; m_availableActivities = tempActivities;
} }
bool LayoutConfigDialog::dataAreAccepted() bool LatteConfigDialog::dataAreAccepted()
{ {
for (int i = 0; i < m_model->rowCount(); ++i) { for (int i = 0; i < m_model->rowCount(); ++i) {
QString layout1 = m_model->data(m_model->index(i, NAMECOLUMN), Qt::DisplayRole).toString(); QString layout1 = m_model->data(m_model->index(i, NAMECOLUMN), Qt::DisplayRole).toString();
@ -836,7 +834,7 @@ bool LayoutConfigDialog::dataAreAccepted()
return true; return true;
} }
bool LayoutConfigDialog::saveAllChanges() bool LatteConfigDialog::saveAllChanges()
{ {
if (!dataAreAccepted()) { if (!dataAreAccepted()) {
return false; return false;
@ -977,7 +975,7 @@ bool LayoutConfigDialog::saveAllChanges()
return true; return true;
} }
bool LayoutConfigDialog::idExistsInModel(QString id) bool LatteConfigDialog::idExistsInModel(QString id)
{ {
for (int i = 0; i < m_model->rowCount(); ++i) { for (int i = 0; i < m_model->rowCount(); ++i) {
QString rowId = m_model->data(m_model->index(i, IDCOLUMN), Qt::DisplayRole).toString(); QString rowId = m_model->data(m_model->index(i, IDCOLUMN), Qt::DisplayRole).toString();
@ -990,7 +988,7 @@ bool LayoutConfigDialog::idExistsInModel(QString id)
return false; return false;
} }
bool LayoutConfigDialog::nameExistsInModel(QString name) bool LatteConfigDialog::nameExistsInModel(QString name)
{ {
for (int i = 0; i < m_model->rowCount(); ++i) { for (int i = 0; i < m_model->rowCount(); ++i) {
QString rowName = m_model->data(m_model->index(i, NAMECOLUMN), Qt::DisplayRole).toString(); QString rowName = m_model->data(m_model->index(i, NAMECOLUMN), Qt::DisplayRole).toString();
@ -1003,7 +1001,7 @@ bool LayoutConfigDialog::nameExistsInModel(QString name)
return false; return false;
} }
int LayoutConfigDialog::ascendingRowFor(QString name) int LatteConfigDialog::ascendingRowFor(QString name)
{ {
for (int i = 0; i < m_model->rowCount(); ++i) { for (int i = 0; i < m_model->rowCount(); ++i) {
QString rowName = m_model->data(m_model->index(i, NAMECOLUMN), Qt::DisplayRole).toString(); QString rowName = m_model->data(m_model->index(i, NAMECOLUMN), Qt::DisplayRole).toString();
@ -1016,7 +1014,7 @@ int LayoutConfigDialog::ascendingRowFor(QString name)
return m_model->rowCount(); return m_model->rowCount();
} }
QString LayoutConfigDialog::uniqueTempDirectory() QString LatteConfigDialog::uniqueTempDirectory()
{ {
QTemporaryDir tempDir; QTemporaryDir tempDir;
tempDir.setAutoRemove(false); tempDir.setAutoRemove(false);
@ -1025,7 +1023,7 @@ QString LayoutConfigDialog::uniqueTempDirectory()
return tempDir.path(); return tempDir.path();
} }
QString LayoutConfigDialog::uniqueLayoutName(QString name) QString LatteConfigDialog::uniqueLayoutName(QString name)
{ {
int pos_ = name.lastIndexOf(QRegExp(QString("[-][0-9]+"))); int pos_ = name.lastIndexOf(QRegExp(QString("[-][0-9]+")));

@ -19,8 +19,8 @@
* *
*/ */
#ifndef LAYOUTCONFIGDIALOG_H #ifndef LATTECONFIGDIALOG_H
#define LAYOUTCONFIGDIALOG_H #define LATTECONFIGDIALOG_H
#include "layoutmanager.h" #include "layoutmanager.h"
#include "layout.h" #include "layout.h"
@ -32,7 +32,7 @@
#include <QStandardItemModel> #include <QStandardItemModel>
namespace Ui { namespace Ui {
class LayoutConfigDialog; class LatteConfigDialog;
} }
namespace KActivities { namespace KActivities {
@ -46,11 +46,11 @@ class Layout;
namespace Latte { namespace Latte {
class LayoutConfigDialog : public QDialog { class LatteConfigDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
LayoutConfigDialog(QWidget *parent, LayoutManager *corona); LatteConfigDialog(QWidget *parent, LayoutManager *corona);
~LayoutConfigDialog(); ~LatteConfigDialog();
QStringList activities(); QStringList activities();
QStringList availableActivities(); QStringList availableActivities();
@ -101,11 +101,11 @@ private:
LayoutManager *m_manager{nullptr}; LayoutManager *m_manager{nullptr};
QStandardItemModel *m_model{nullptr}; QStandardItemModel *m_model{nullptr};
Ui::LayoutConfigDialog *ui; Ui::LatteConfigDialog *ui;
QHash<const QString, Layout *> m_layouts; QHash<const QString, Layout *> m_layouts;
}; };
} }
#endif // LAYOUTCONFIGDIALOG_H #endif // LATTECONFIGDIALOG_H

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>LayoutConfigDialog</class> <class>LatteConfigDialog</class>
<widget class="QDialog" name="LayoutConfigDialog"> <widget class="QDialog" name="LatteConfigDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -11,13 +11,13 @@
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string/> <string comment="latte settings window">Settings</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="layoutsTab"> <widget class="QWidget" name="layoutsTab">
<attribute name="title"> <attribute name="title">
@ -102,7 +102,7 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<attribute name="horizontalHeaderVisible"> <attribute name="horizontalHeaderVisible">
<bool>false</bool> <bool>true</bool>
</attribute> </attribute>
<attribute name="horizontalHeaderCascadingSectionResizes"> <attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool> <bool>true</bool>
@ -176,6 +176,9 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="newButton"> <widget class="QPushButton" name="newButton">
<property name="toolTip">
<string>New layout</string>
</property>
<property name="text"> <property name="text">
<string comment="new layout">New</string> <string comment="new layout">New</string>
</property> </property>
@ -187,6 +190,9 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="copyButton"> <widget class="QPushButton" name="copyButton">
<property name="toolTip">
<string>Copy layout</string>
</property>
<property name="text"> <property name="text">
<string comment="copy layout">Copy</string> <string comment="copy layout">Copy</string>
</property> </property>
@ -201,6 +207,9 @@
</item> </item>
<item> <item>
<widget class="QPushButton" name="removeButton"> <widget class="QPushButton" name="removeButton">
<property name="toolTip">
<string>Remove layout</string>
</property>
<property name="text"> <property name="text">
<string comment="remove layout">Remove</string> <string comment="remove layout">Remove</string>
</property> </property>
@ -290,7 +299,7 @@
<item> <item>
<widget class="QPushButton" name="exportButton"> <widget class="QPushButton" name="exportButton">
<property name="toolTip"> <property name="toolTip">
<string>Export layout of full configuration</string> <string>Export layout or full configuration</string>
</property> </property>
<property name="text"> <property name="text">
<string comment="export layout">Export</string> <string comment="export layout">Export</string>
@ -337,7 +346,7 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="settingsTab"> <widget class="QWidget" name="preferencesTab">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -345,7 +354,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<attribute name="title"> <attribute name="title">
<string>Settings</string> <string>Preferences</string>
</attribute> </attribute>
<layout class="QHBoxLayout" name="horizontalLayout_4"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="rightMargin"> <property name="rightMargin">
@ -576,6 +585,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Low sensitivity for parabolic effect (low cpu usage)</string>
</property>
<property name="text"> <property name="text">
<string comment="low sensitivity">Low</string> <string comment="low sensitivity">Low</string>
</property> </property>
@ -589,6 +601,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>Medium sensitivity for parabolic effect (normal cpu usage)</string>
</property>
<property name="text"> <property name="text">
<string comment="medium sensitivity">Medium</string> <string comment="medium sensitivity">Medium</string>
</property> </property>
@ -603,7 +618,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string/> <string>High sensitivity for parabolic effect (high cpu usage)</string>
</property> </property>
<property name="text"> <property name="text">
<string comment="high sensitivity">High</string> <string comment="high sensitivity">High</string>
@ -654,7 +669,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>LayoutConfigDialog</receiver> <receiver>LatteConfigDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
@ -670,7 +685,7 @@
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>LayoutConfigDialog</receiver> <receiver>LatteConfigDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">

@ -1019,18 +1019,18 @@ bool LayoutManager::layoutIsAssigned(QString layoutName)
return false; return false;
} }
void LayoutManager::showLayoutConfigDialog() void LayoutManager::showLatteConfigDialog()
{ {
if (!m_layoutConfigDialog) if (!m_latteConfigDialog)
m_layoutConfigDialog = new LayoutConfigDialog(nullptr, this); m_latteConfigDialog = new LatteConfigDialog(nullptr, this);
m_layoutConfigDialog->show(); m_latteConfigDialog->show();
if (m_layoutConfigDialog->isMinimized()) { if (m_latteConfigDialog->isMinimized()) {
m_layoutConfigDialog->showNormal(); m_latteConfigDialog->showNormal();
} }
m_layoutConfigDialog->activateWindow(); m_latteConfigDialog->activateWindow();
} }
void LayoutManager::showInfoWindow(QString info, int duration, QStringList activities) void LayoutManager::showInfoWindow(QString info, int duration, QStringList activities)

@ -23,7 +23,7 @@
#include "importer.h" #include "importer.h"
#include "layout.h" #include "layout.h"
#include "layoutconfigdialog.h" #include "latteconfigdialog.h"
#include "launcherssignals.h" #include "launcherssignals.h"
#include <QAction> #include <QAction>
@ -34,7 +34,7 @@
class DockCorona; class DockCorona;
class Importer; class Importer;
class Layout; class Layout;
class LayoutConfigDialog; class LatteConfigDialog;
class LaunchersSignals; class LaunchersSignals;
namespace KActivities { namespace KActivities {
@ -105,7 +105,7 @@ public:
void importPresets(bool includeDefault = false); void importPresets(bool includeDefault = false);
public slots: public slots:
Q_INVOKABLE void showLayoutConfigDialog(); Q_INVOKABLE void showLatteConfigDialog();
//! switch to specified layout, default previousMemoryUsage means that it didnt change //! switch to specified layout, default previousMemoryUsage means that it didnt change
Q_INVOKABLE bool switchToLayout(QString layoutName, int previousMemoryUsage = -1); Q_INVOKABLE bool switchToLayout(QString layoutName, int previousMemoryUsage = -1);
@ -168,7 +168,7 @@ private:
QAction *m_addWidgetsAction{nullptr}; QAction *m_addWidgetsAction{nullptr};
QPointer<LayoutConfigDialog> m_layoutConfigDialog; QPointer<LatteConfigDialog> m_latteConfigDialog;
QHash<const QString, QString> m_assignedLayouts; QHash<const QString, QString> m_assignedLayouts;
@ -181,7 +181,7 @@ private:
KActivities::Controller *m_activitiesController; KActivities::Controller *m_activitiesController;
friend class LayoutConfigDialog; friend class LatteConfigDialog;
}; };
} }

@ -13,7 +13,7 @@
ActivityCmbBoxDelegate::ActivityCmbBoxDelegate(QObject *parent) ActivityCmbBoxDelegate::ActivityCmbBoxDelegate(QObject *parent)
: QItemDelegate(parent) : QItemDelegate(parent)
{ {
auto *configDialog = qobject_cast<Latte::LayoutConfigDialog *>(parent); auto *configDialog = qobject_cast<Latte::LatteConfigDialog *>(parent);
if (configDialog) { if (configDialog) {
m_configDialog = configDialog; m_configDialog = configDialog;

@ -1,7 +1,7 @@
#ifndef ACTIVITYCMBBOXDELEGATE_H #ifndef ACTIVITYCMBBOXDELEGATE_H
#define ACTIVITYCMBBOXDELEGATE_H #define ACTIVITYCMBBOXDELEGATE_H
#include "../layoutconfigdialog.h" #include "../latteconfigdialog.h"
#include <QItemDelegate> #include <QItemDelegate>
@ -27,7 +27,7 @@ public:
private: private:
QString assignedActivitiesText(const QModelIndex &index) const; QString assignedActivitiesText(const QModelIndex &index) const;
Latte::LayoutConfigDialog *m_configDialog{nullptr}; Latte::LatteConfigDialog *m_configDialog{nullptr};
}; };
#endif #endif

@ -876,7 +876,7 @@ PlasmaComponents.ContextMenu {
var configureItem = menu.newMenuItem(layoutsMenu); var configureItem = menu.newMenuItem(layoutsMenu);
configureItem.text = i18n("Configure..."); configureItem.text = i18n("Configure...");
configureItem.clicked.connect(function() { configureItem.clicked.connect(function() {
latteDock.universalLayoutManager.showLayoutConfigDialog(); latteDock.universalLayoutManager.showLatteConfigDialog();
}); });
} }

@ -119,7 +119,7 @@ PlasmaComponents.Page {
iconSource: "document-edit" iconSource: "document-edit"
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
onClicked: layoutManager.showLayoutConfigDialog() onClicked: layoutManager.showLatteConfigDialog()
} }
} }
} }

Loading…
Cancel
Save