refs #892, settings dialog for core

(settings can also be set in core)
This commit is contained in:
Klaus Basan
2017-02-27 05:37:54 +01:00
committed by Mathew Sutcliffe
parent d495424041
commit 891b67eccc
6 changed files with 199 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
/* Copyright (C) 2016
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "coresettingsdialog.h"
#include "ui_coresettingsdialog.h"
namespace BlackGui
{
namespace Components
{
CCoreSettingsDialog::CCoreSettingsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CCoreSettingsDialog)
{
ui->setupUi(this);
}
CCoreSettingsDialog::~CCoreSettingsDialog()
{ }
} // ns
} // ns

View File

@@ -0,0 +1,44 @@
/* Copyright (C) 2017
* swift project Community / Contributors
*
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
//! \file
#ifndef BLACKGUI_COMPONENTS_CORESETTINGSDIALOG_H
#define BLACKGUI_COMPONENTS_CORESETTINGSDIALOG_H
#include "blackgui/blackguiexport.h"
#include <QDialog>
#include <QScopedPointer>
namespace Ui { class CCoreSettingsDialog; }
namespace BlackGui
{
namespace Components
{
/**
* Core / swift pilot client settings as Dialog
*/
class BLACKGUI_EXPORT CCoreSettingsDialog : public QDialog
{
Q_OBJECT
public:
//! Constructor
explicit CCoreSettingsDialog(QWidget *parent = nullptr);
//! Destructor
virtual ~CCoreSettingsDialog();
private:
QScopedPointer<Ui::CCoreSettingsDialog> ui;
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CCoreSettingsDialog</class>
<widget class="QDialog" name="CCoreSettingsDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<height>400</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>400</height>
</size>
</property>
<property name="windowTitle">
<string>swift settings</string>
</property>
<layout class="QVBoxLayout" name="vl_SettingsDialog">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="BlackGui::Components::CSettingsComponent" name="comp_SettingsComponent"/>
</item>
<item>
<widget class="QDialogButtonBox" name="bb_CoreSettingsDialog">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BlackGui::Components::CSettingsComponent</class>
<extends>QTabWidget</extends>
<header>blackgui/components/settingscomponent.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>bb_CoreSettingsDialog</sender>
<signal>accepted()</signal>
<receiver>CCoreSettingsDialog</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>bb_CoreSettingsDialog</sender>
<signal>rejected()</signal>
<receiver>CCoreSettingsDialog</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

@@ -11,6 +11,7 @@
#include "blackcore/corefacade.h"
#include "blackgui/components/commandinput.h"
#include "blackgui/components/coreinfoareacomponent.h"
#include "blackgui/components/coresettingsdialog.h"
#include "blackgui/components/logcomponent.h"
#include "blackgui/guiapplication.h"
#include "blackgui/stylesheetutility.h"
@@ -120,6 +121,15 @@ void CSwiftCore::ps_p2pModeToggled(bool checked)
}
}
void CSwiftCore::ps_showSettingsDialog()
{
if (!m_settingsDialog)
{
m_settingsDialog.reset(new CCoreSettingsDialog(this));
}
m_settingsDialog->show();
}
void CSwiftCore::ps_onStyleSheetsChanged()
{
this->initStyleSheet();
@@ -150,6 +160,7 @@ void CSwiftCore::initMenus()
sGui->addMenuFile(*ui->menu_File);
sGui->addMenuWindow(*ui->menu_Window);
sGui->addMenuHelp(*ui->menu_Help);
connect(ui->menu_SettingsDialog, &QAction::triggered, this, &CSwiftCore::ps_showSettingsDialog);
}
void CSwiftCore::startCore(const QString &dBusAdress)

View File

@@ -22,7 +22,7 @@
#include <QString>
class QWidget;
namespace BlackGui { namespace Components { class CCoreSettingsDialog; }}
namespace Ui { class CSwiftCore; }
/*!
@@ -52,6 +52,9 @@ private slots:
void ps_p2pModeToggled(bool checked);
//! @}
//! Show the settings dialog
void ps_showSettingsDialog();
//! Style sheet has changed
virtual void ps_onStyleSheetsChanged();
@@ -69,6 +72,7 @@ private:
void stopCore();
QString getDBusAddress() const;
QScopedPointer<BlackGui::Components::CCoreSettingsDialog> m_settingsDialog;
QScopedPointer<Ui::CSwiftCore> ui;
};

View File

@@ -156,10 +156,26 @@ QTextEdit {
<string>&amp;Window</string>
</property>
</widget>
<widget class="QMenu" name="menu_Settings">
<property name="title">
<string>Settings</string>
</property>
<addaction name="menu_SettingsDialog"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Window"/>
<addaction name="menu_Help"/>
<addaction name="menu_Settings"/>
</widget>
<action name="menu_SettingsDialog">
<property name="icon">
<iconset resource="../blackmisc/blackmisc.qrc">
<normaloff>:/pastel/icons/pastel/16/wrench-orange.png</normaloff>:/pastel/icons/pastel/16/wrench-orange.png</iconset>
</property>
<property name="text">
<string>Modify settings</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
@@ -188,6 +204,8 @@ QTextEdit {
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../blackmisc/blackmisc.qrc"/>
</resources>
<connections/>
</ui>