1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-26 23:21:37 +03:00

Adding layouts config dialog

This commit is contained in:
Johan Smith Agudelo Rodriguez 2017-07-05 14:03:39 -05:00 committed by Michail Vourlakos
parent 569d9fe2d1
commit 0b4dc7ce3e
7 changed files with 306 additions and 16 deletions

View File

@ -18,12 +18,14 @@ set(lattedock-app_SRCS
universalsettings.cpp
layoutmanager.cpp
layoutsettings.cpp
layoutconfigdialog.cpp
importer.cpp
main.cpp
)
set(latte_dbusXML dbus/org.kde.LatteDock.xml)
qt5_add_dbus_adaptor(lattedock-app_SRCS ${latte_dbusXML} dockcorona.h Latte::DockCorona lattedockadaptor)
ki18n_wrap_ui(lattedock-app_SRCS layoutconfigdialog.ui)
add_executable(latte-dock ${lattedock-app_SRCS})

View File

@ -1056,7 +1056,7 @@ void DockView::setMaskArea(QRect area)
setMask(fixedMask);
}
//qDebug() << "dock mask set:" << m_maskArea;
qDebug() << "dock mask set:" << m_maskArea;
emit maskAreaChanged();
}
@ -1231,6 +1231,15 @@ bool DockView::tasksPresent()
return false;
}
void DockView::showLayoutConfigDialog()
{
if (!m_layoutConfigDialog)
m_layoutConfigDialog = new LayoutConfigDialog(nullptr);
m_layoutConfigDialog->show();
}
//!check if the plasmoid with _name_ exists in the midedata
bool DockView::mimeContainsPlasmoid(QMimeData *mimeData, QString name)
{
@ -1908,5 +1917,6 @@ void DockView::restoreConfig()
}
//!END configuration functions
QPointer<LayoutConfigDialog> DockView::m_layoutConfigDialog;
}
//!END namespace

View File

@ -25,6 +25,7 @@
#include "plasmaquick/containmentview.h"
#include "visibilitymanager.h"
#include "../liblattedock/dock.h"
#include "layoutconfigdialog.h"
#include <QQuickView>
#include <QQmlListProperty>
@ -179,6 +180,8 @@ public slots:
Q_INVOKABLE bool setCurrentScreen(const QString id);
Q_INVOKABLE bool tasksPresent();
Q_INVOKABLE void showLayoutConfigDialog();
Q_INVOKABLE void closeApplication();
void updateAbsDockGeometry(bool bypassChecks = false);
@ -274,6 +277,8 @@ private:
QPointer<PlasmaQuick::ConfigView> m_configView;
QPointer<VisibilityManager> m_visibility;
QPointer<QScreen> m_screenToFollow;
static QPointer<LayoutConfigDialog> m_layoutConfigDialog;
QString m_screenToFollowId;
QTimer m_screenSyncTimer;

View File

@ -0,0 +1,77 @@
/*
* Copyright 2017 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "ui_layoutconfigdialog.h"
#include "layoutconfigdialog.h"
Latte::LayoutConfigDialog::LayoutConfigDialog(QWidget* parent)
: QDialog(parent), ui(new Ui::LayoutConfigDialog)
{
ui->setupUi(this);
//QMetaObject::connectSlotsByName(this);
}
Latte::LayoutConfigDialog::~LayoutConfigDialog()
{
qDebug() << Q_FUNC_INFO;
}
void Latte::LayoutConfigDialog::on_copyButton_clicked()
{
qDebug() << Q_FUNC_INFO;
}
void Latte::LayoutConfigDialog::on_removeButton_clicked()
{
qDebug() << Q_FUNC_INFO;
}
void Latte::LayoutConfigDialog::on_importButton_clicked()
{
qDebug() << Q_FUNC_INFO;
}
void Latte::LayoutConfigDialog::on_exportButton_clicked()
{
qDebug() << Q_FUNC_INFO;
}
void Latte::LayoutConfigDialog::on_okButton_clicked()
{
qDebug() << Q_FUNC_INFO;
}
void Latte::LayoutConfigDialog::on_applyButton_cliked()
{
qDebug() << Q_FUNC_INFO;
}
void Latte::LayoutConfigDialog::on_cancelButton_clicked()
{
qDebug() << Q_FUNC_INFO;
}
void Latte::LayoutConfigDialog::on_resetButton_clicked()
{
qDebug() << Q_FUNC_INFO;
}

61
app/layoutconfigdialog.h Normal file
View File

@ -0,0 +1,61 @@
/*
* Copyright 2017 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef LAYOUTCONFIGDIALOG_H
#define LAYOUTCONFIGDIALOG_H
#include <QObject>
#include <QDialog>
#include <QDebug>
namespace Ui
{
class LayoutConfigDialog;
}
namespace Latte {
class LayoutConfigDialog : public QDialog
{
Q_OBJECT
public:
LayoutConfigDialog(QWidget *parent);
~LayoutConfigDialog();
private slots:
void on_copyButton_clicked();
void on_removeButton_clicked();
void on_importButton_clicked();
void on_exportButton_clicked();
void on_okButton_clicked();
void on_applyButton_cliked();
void on_cancelButton_clicked();
void on_resetButton_clicked();
private:
Ui::LayoutConfigDialog* ui;
};
}
#endif // LAYOUTCONFIGDIALOG_H

148
app/layoutconfigdialog.ui Normal file
View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>LayoutConfigDialog</class>
<widget class="QDialog" name="LayoutConfigDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>491</width>
<height>348</height>
</rect>
</property>
<property name="windowTitle">
<string>Layouts editor</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset theme="preferences-other">
<normaloff>.</normaloff>.</iconset>
</attribute>
<attribute name="title">
<string>Layouts</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QTableView" name="layoutsView">
<property name="showGrid">
<bool>false</bool>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>true</bool>
</attribute>
</widget>
</item>
<item row="0" column="1">
<widget class="QWidget" name="widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="copyButton">
<property name="text">
<string>Copy</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="importButton">
<property name="text">
<string>Import</string>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exportButton">
<property name="text">
<string>Export</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>LayoutConfigDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>LayoutConfigDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -114,22 +114,9 @@ PlasmaComponents.Page {
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Import")
enabled: false
onClicked: {
globalSettings.importConfiguration()
}
text: i18n("Layouts")
onClicked: dock.showLayoutConfigDialog()
}
PlasmaComponents.Button {
Layout.fillWidth: true
text: i18n("Export")
enabled: false
onClicked: {
globalSettings.exportConfiguration()
}
}
}
}
//! END: Layout