Added "About swift dialog"

* Details as text edit, so users can cut and paste it for bug reports
* Removed setup/compile info from internals and show it in about
* display Qt icon for "About Qt"
This commit is contained in:
Klaus Basan
2017-07-14 19:57:38 +02:00
committed by Mathew Sutcliffe
parent 94c9886c35
commit 8c9e3541ee
5 changed files with 192 additions and 21 deletions

View File

@@ -512,13 +512,13 @@ namespace BlackCore
QLatin1String(" Windows 10: ") %
boolToYesNo(CBuildConfig::isRunningOnWindows10()) %
separator %
QLatin1String("MacOSX: ") %
boolToYesNo(CBuildConfig::isRunningOnMacOSXPlatform()) %
QLatin1String(" Linux: ") %
QLatin1String("Linux: ") %
boolToYesNo(CBuildConfig::isRunningOnLinuxPlatform()) %
QLatin1String(" Unix: ") %
boolToYesNo(CBuildConfig::isRunningOnUnixPlatform()) %
separator %
QLatin1String("Unix: ") %
boolToYesNo(CBuildConfig::isRunningOnUnixPlatform());
QLatin1String("MacOSX: ") %
boolToYesNo(CBuildConfig::isRunningOnMacOSXPlatform());
return env;
}

View File

@@ -0,0 +1,37 @@
/* 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.
*/
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
#include "blackgui/guiapplication.h"
namespace BlackGui
{
namespace Components
{
CAboutDialog::CAboutDialog(QWidget *parent) :
QDialog(parent), ui(new Ui::CAboutDialog)
{
ui->setupUi(this);
this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
this->init();
}
CAboutDialog::~CAboutDialog()
{ }
void CAboutDialog::init()
{
ui->lbl_VersionValue->setText(sGui->getApplicationNameVersionBetaDev());
ui->pte_Info->setPlainText(sGui->getInfoString("\n"));
ui->pte_Info->appendPlainText("\nSetup follows:\n----");
ui->pte_Info->appendPlainText(sGui->getGlobalSetup().convertToQString("\n", true));
}
} // ns
} // ns

View File

@@ -0,0 +1,46 @@
/* 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_ABOUTDIALOG_H
#define BLACKGUI_COMPONENTS_ABOUTDIALOG_H
#include <QDialog>
#include <QScopedPointer>
namespace Ui { class CAboutDialog; }
namespace BlackGui
{
namespace Components
{
/*!
* About dialog
*/
class CAboutDialog : public QDialog
{
Q_OBJECT
public:
//! Constructor
explicit CAboutDialog(QWidget *parent = nullptr);
//! Destructor
virtual ~CAboutDialog();
private:
//! Init values
void init();
QScopedPointer<Ui::CAboutDialog> ui;
};
} // ns
} // ns
#endif // guard

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CAboutDialog</class>
<widget class="QDialog" name="CAboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>320</width>
<height>258</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>200</height>
</size>
</property>
<property name="windowTitle">
<string>About swift</string>
</property>
<property name="modal">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="fl_AboutDialog">
<item row="0" column="0">
<widget class="QLabel" name="lbl_Version">
<property name="text">
<string>Version:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPlainTextEdit" name="pte_Info">
<property name="documentTitle">
<string>about swift details</string>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::NoWrap</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDialogButtonBox" name="bb_AboutDialog">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lbl_VersionValue">
<property name="text">
<string>Version ....</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_Details">
<property name="text">
<string>Details:</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>bb_AboutDialog</sender>
<signal>accepted()</signal>
<receiver>CAboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>261</x>
<y>248</y>
</hint>
<hint type="destinationlabel">
<x>319</x>
<y>199</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -12,6 +12,7 @@
#include "blackcore/data/globalsetup.h"
#include "blackgui/components/applicationclosedialog.h"
#include "blackgui/components/downloadandinstalldialog.h"
#include "blackgui/components/aboutdialog.h"
#include "blackgui/guiapplication.h"
#include "blackgui/guiutility.h"
#include "blackgui/registermetadata.h"
@@ -462,20 +463,6 @@ namespace BlackGui
this->displayTextInConsole(getAllUserMetatypesTypes());
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
a = menu.addAction("Setup");
c = connect(a, &QAction::triggered, this, [a, this]()
{
this->displayTextInConsole(this->getGlobalSetup().convertToQString("\n", true));
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
a = menu.addAction("Compile info");
c = connect(a, &QAction::triggered, this, [a, this]()
{
this->displayTextInConsole(this->getInfoString("\n"));
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c);
}
@@ -526,7 +513,7 @@ namespace BlackGui
void CGuiApplication::addMenuHelp(QMenu &menu)
{
const QWidget *w = mainApplicationWindow();
QWidget *w = mainApplicationWindow();
if (!w) { return; }
QAction *a = menu.addAction(w->style()->standardIcon(QStyle::SP_TitleBarContextHelpButton), "Online help");
bool c = connect(a, &QAction::triggered, this, [this]()
@@ -535,7 +522,17 @@ namespace BlackGui
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
a = menu.addAction("About Qt");
a = menu.addAction(QApplication::windowIcon(), "About swift");
c = connect(a, &QAction::triggered, this, [w]()
{
CAboutDialog dialog(w);
dialog.exec();
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c);
// https://joekuan.wordpress.com/2015/09/23/list-of-qt-icons/
a = menu.addAction(QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton), "About Qt");
c = connect(a, &QAction::triggered, this, []()
{
QApplication::aboutQt();