forked from qt-creator/qt-creator
Core: Allow adding additional information to about dialog.
Purpose is to get rid of hard coded license information string in the Qt Creator binary. Change-Id: I867e2aed010f8a622adfbb89ac96dccbc8229161 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -572,6 +572,16 @@ void ICore::saveSettings()
|
||||
ICore::settings(QSettings::UserScope)->sync();
|
||||
}
|
||||
|
||||
QStringList ICore::additionalAboutInformation()
|
||||
{
|
||||
return m_mainwindow->additionalAboutInformation();
|
||||
}
|
||||
|
||||
void ICore::appendAboutInformation(const QString &line)
|
||||
{
|
||||
m_mainwindow->appendAboutInformation(line);
|
||||
}
|
||||
|
||||
void ICore::validateNewItemDialogIsRunning()
|
||||
{
|
||||
static bool wasRunning = false;
|
||||
|
||||
@@ -146,6 +146,11 @@ signals:
|
||||
void contextChanged(const Core::Context &context);
|
||||
void themeChanged();
|
||||
|
||||
public:
|
||||
/* internal use */
|
||||
static QStringList additionalAboutInformation();
|
||||
static void appendAboutInformation(const QString &line);
|
||||
|
||||
private:
|
||||
static void validateNewItemDialogIsRunning();
|
||||
static void newItemDialogOpened();
|
||||
|
||||
@@ -239,6 +239,16 @@ void MainWindow::setOverrideColor(const QColor &color)
|
||||
m_overrideColor = color;
|
||||
}
|
||||
|
||||
QStringList MainWindow::additionalAboutInformation() const
|
||||
{
|
||||
return m_aboutInformation;
|
||||
}
|
||||
|
||||
void MainWindow::appendAboutInformation(const QString &line)
|
||||
{
|
||||
m_aboutInformation.append(line);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
// explicitly delete window support, because that calls methods from ICore that call methods
|
||||
|
||||
@@ -110,6 +110,9 @@ public:
|
||||
|
||||
void setOverrideColor(const QColor &color);
|
||||
|
||||
QStringList additionalAboutInformation() const;
|
||||
void appendAboutInformation(const QString &line);
|
||||
|
||||
signals:
|
||||
void newItemDialogRunningChanged();
|
||||
|
||||
@@ -152,6 +155,7 @@ private:
|
||||
void writeSettings();
|
||||
|
||||
ICore *m_coreImpl;
|
||||
QStringList m_aboutInformation;
|
||||
Context m_highPrioAdditionalContexts;
|
||||
Context m_lowPrioAdditionalContexts;
|
||||
SettingsDatabase *m_settingsDatabase;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <app/app_version.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -68,14 +69,19 @@ VersionDialog::VersionDialog(QWidget *parent)
|
||||
buildDateInfo = tr("<br/>Built on %1 %2<br/>").arg(QLatin1String(__DATE__), QLatin1String(__TIME__));
|
||||
#endif
|
||||
|
||||
const QString br = QLatin1String("<br/>");
|
||||
const QStringList additionalInfoLines = ICore::additionalAboutInformation();
|
||||
const QString additionalInfo = Utils::transform(additionalInfoLines, &QString::toHtmlEscaped)
|
||||
.join(br);
|
||||
|
||||
const QString description = tr(
|
||||
const QString description = tr(
|
||||
"<h3>%1</h3>"
|
||||
"%2<br/>"
|
||||
"%3"
|
||||
"%4"
|
||||
"%5"
|
||||
"<br/>"
|
||||
"Copyright 2008-%5 %6. All rights reserved.<br/>"
|
||||
"Copyright 2008-%6 %7. All rights reserved.<br/>"
|
||||
"<br/>"
|
||||
"The program is provided AS IS with NO WARRANTY OF ANY KIND, "
|
||||
"INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A "
|
||||
@@ -84,6 +90,7 @@ VersionDialog::VersionDialog(QWidget *parent)
|
||||
ICore::buildCompatibilityString(),
|
||||
buildDateInfo,
|
||||
ideRev,
|
||||
additionalInfo.isEmpty() ? QString() : br + additionalInfo + br,
|
||||
QLatin1String(Constants::IDE_YEAR),
|
||||
QLatin1String(Constants::IDE_AUTHOR));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user