About Dialog Improvements

This commit is contained in:
baydam
2016-10-07 15:17:00 +00:00
parent 96dc19a0fa
commit fbee418df5
5 changed files with 249 additions and 23 deletions
+151
View File
@@ -0,0 +1,151 @@
/*
* AboutDialog.cpp
*
* (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com
*
* This program 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 3 of the License, or
* (at your option) any later version.
*
* This program 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 "AboutDialog.h"
#include <QtWidgets>
MM_BEGIN_NAMESPACE
AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent)
{
// Defines fixed size
setFixedSize(ABOUT_WINDOW_WIDTH, ABOUT_WINDOW_HEIGHT);
// Set title
setWindowTitle(tr("About %1").arg(MM::APPLICATION_NAME));
// Set Layout
_mainLayout = new QGridLayout;
setLayout(_mainLayout);
// Set icon label
_iconLabel = new QLabel;
_iconLabel->setPixmap(QPixmap(":/mapmap-logo").scaled(64, 64));
_mainLayout->addWidget(_iconLabel, 0, 0, 1, 1, Qt::AlignCenter);
// Set title label
_textLabel = new QLabel;
_textLabel->setPixmap(QPixmap(":/mapmap-title"));
_mainLayout->addWidget(_textLabel, 0, 1, 1, 1);
// Set version label
_versionLabel = new QLabel;
_versionLabel->setText(QString("<h2> %1 </h2>").arg(MM::VERSION));
_versionLabel->setContentsMargins(7, 0, 0, 7);
_mainLayout->addWidget(_versionLabel, 0, 2, 1, 1, Qt::AlignBottom);
// Add tab widget
_tabWidget = new QTabWidget;
_mainLayout->addWidget(_tabWidget, 1, 0, 1, 3);
// Close button
_buttonBox = new QDialogButtonBox(QDialogButtonBox::Close);
connect(_buttonBox, SIGNAL(rejected()), this, SLOT(close()));
_mainLayout->addWidget(_buttonBox, 2, 0, 1, 3);
// Create and fill different tabs
createAboutTab();
// Changelog Tab
createChangelogTab();
// Librairies
createLibrairiesTab();
// Contributors
createContributorsTab();
// License
createLicenseTab();
}
void AboutDialog::createAboutTab()
{
_aboutTextBrowser = new QTextBrowser;
_aboutTextBrowser->setOpenExternalLinks(true);
QString aboutText;
// Software description
QString aboutSoftwareText = "<p>" + tr("MapMap is a free/open source video mapping software.") + "</p>";
// Copyright and software owners
QString copyrightText = "<p>" + tr("Copyright &copy; 2013 %1.").arg(MM::COPYRIGHT_OWNERS) + "</p>";
// License short notice
QFile licenseShortFile(":/license-short");
licenseShortFile.open(QIODevice::ReadOnly | QIODevice::Text);
QString licenseNoticeText = Qt::convertFromPlainText(QTextCodec::codecForName("UTF-8")->toUnicode(licenseShortFile.readAll()), Qt::WhiteSpaceNormal);
// About projection mapping
QFile aboutMappingFile(":/projection-mapping");
aboutMappingFile.open(QIODevice::ReadOnly | QIODevice::Text);
QString aboutMappingText = QTextCodec::codecForName("UTF-8")->toUnicode(aboutMappingFile.readAll());
// Visit our website for more information
QString projectWebsiteText = "<p>" + tr("See the ") + QString("<a href=\"%1\">").arg(MM::ORGANIZATION_DOMAIN) +
tr("%1 website").arg(MM::APPLICATION_NAME) + "</a> for more information on this software.</p>";
// Append texts
aboutText.append(aboutSoftwareText);
aboutText.append(copyrightText);
aboutText.append(licenseNoticeText);
aboutText.append(aboutMappingText);
aboutText.append(projectWebsiteText);
// Set about text
_aboutTextBrowser->setText(aboutText);
_tabWidget->addTab(_aboutTextBrowser, tr("About"));
}
void AboutDialog::createChangelogTab()
{
_changelogTextBrowser = new QTextBrowser;
_changelogTextBrowser->setOpenExternalLinks(true);
QFile changelogFile(":/changelog");
changelogFile.open(QIODevice::ReadOnly | QIODevice::Text);
_changelogTextBrowser->setText(QTextCodec::codecForName("UTF-8")->toUnicode(changelogFile.readAll()));
_tabWidget->addTab(_changelogTextBrowser, tr("Changelog"));
}
void AboutDialog::createLibrairiesTab()
{
_librariesTextBrowser = new QTextBrowser;
_librariesTextBrowser->setOpenExternalLinks(true);
_tabWidget->addTab(_librariesTextBrowser, tr("Librairies"));
}
void AboutDialog::createContributorsTab()
{
_contributorsTextBrowser = new QTextBrowser;
_contributorsTextBrowser->setOpenExternalLinks(true);
QFile contributorsFile(":/contributors");
contributorsFile.open(QIODevice::ReadOnly | QIODevice::Text);
_contributorsTextBrowser->setText(QTextCodec::codecForName("UTF-8")->toUnicode(contributorsFile.readAll()));
_tabWidget->addTab(_contributorsTextBrowser, tr("Contributors"));
}
void AboutDialog::createLicenseTab()
{
_licenseTextBrowser = new QTextBrowser;
_licenseTextBrowser->setOpenExternalLinks(true);
QFile licenseFile(":/license");
licenseFile.open(QIODevice::ReadOnly | QIODevice::Text);
_licenseTextBrowser->setText(QTextCodec::codecForName("UTF-8")->toUnicode(licenseFile.readAll()));
_tabWidget->addTab(_licenseTextBrowser, tr("License"));
}
MM_END_NAMESPACE
+67
View File
@@ -0,0 +1,67 @@
/*
* AboutDialog.h
*
* (c) 2016 Dame Diongue -- baydamd(@)gmail(.)com
*
* This program 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 3 of the License, or
* (at your option) any later version.
*
* This program 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 ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
#include "GuiForward.h"
#include "MM.h"
MM_BEGIN_NAMESPACE
class AboutDialog : public QDialog
{
Q_OBJECT
public:
AboutDialog(QWidget *parent = 0);
~AboutDialog() {}
public slots:
private:
void createAboutTab();
void createChangelogTab();
void createLibrairiesTab();
void createContributorsTab();
void createLicenseTab();
QGridLayout *_mainLayout;
QLabel *_iconLabel;
QLabel *_textLabel;
QLabel *_versionLabel;
QTabWidget *_tabWidget;
QTextBrowser *_aboutTextBrowser;
QTextBrowser *_changelogTextBrowser;
QTextBrowser *_librariesTextBrowser;
QTextBrowser *_contributorsTextBrowser;
QTextBrowser *_licenseTextBrowser;
QDialogButtonBox *_buttonBox;
// Constantes
static const int ABOUT_WINDOW_WIDTH = 540;
static const int ABOUT_WINDOW_HEIGHT = 720;
};
MM_END_NAMESPACE
#endif // ABOUTDIALOG_H
+1 -1
View File
@@ -24,7 +24,7 @@ MM_BEGIN_NAMESPACE
const QString MM::APPLICATION_NAME = "MapMap";
const QString MM::VERSION = "0.4.1";
const QString MM::COPYRIGHT_OWNERS = "Sofian Audry, Alexandre Quessy, Dame Diongue, Mike Latona, Vasilis Liaskovitis";
const QString MM::COPYRIGHT_OWNERS = "Sofian Audry, Dame Diongue, Alexandre Quessy, Mike Latona, Vasilis Liaskovitis";
const QString MM::ORGANIZATION_NAME = "MapMap";
const QString MM::ORGANIZATION_DOMAIN = "mapmap.info";
const QString MM::FILE_EXTENSION = "mmp";
+26 -21
View File
@@ -21,6 +21,7 @@
#include "MainWindow.h"
#include "PreferenceDialog.h"
#include "AboutDialog.h"
#include "Commands.h"
#include "ProjectWriter.h"
#include "ProjectReader.h"
@@ -676,27 +677,31 @@ void MainWindow::about()
// Stop video playback to avoid lags. XXX Hack
videoTimer->stop();
// Pop-up about dialog.
QMessageBox::about(this, tr("About MapMap"),
tr("<h2><img src=\":mapmap-title\"/> %1</h2>"
"<p>Copyright &copy; 2013 %2.</p>"
"<p>MapMap is a free software for video mapping.</p>"
"<p>Projection mapping, also known as video mapping and spatial augmented reality, "
"is a projection technology used to turn objects, often irregularly shaped, into "
"a display surface for video projection. These objects may be complex industrial "
"landscapes, such as buildings. By using specialized software, a two or three "
"dimensional object is spatially mapped on the virtual program which mimics the "
"real environment it is to be projected on. The software can interact with a "
"projector to fit any desired image onto the surface of that object. This "
"technique is used by artists and advertisers alike who can add extra dimensions, "
"optical illusions, and notions of movement onto previously static objects. The "
"video is commonly combined with, or triggered by, audio to create an "
"audio-visual narrative."
"This project was made possible by the support of the International Organization of "
"La Francophonie.</p>"
"<p>http://mapmap.info<br />"
"http://www.francophonie.org</p>"
).arg(MM::VERSION, MM::COPYRIGHT_OWNERS));
// // Pop-up about dialog.
// QMessageBox::about(this, tr("About MapMap"),
// tr("<h2><img src=\":mapmap-title\"/> %1</h2>"
// "<p>Copyright &copy; 2013 %2.</p>"
// "<p>MapMap is a free software for video mapping.</p>"
// "<p>Projection mapping, also known as video mapping and spatial augmented reality, "
// "is a projection technology used to turn objects, often irregularly shaped, into "
// "a display surface for video projection. These objects may be complex industrial "
// "landscapes, such as buildings. By using specialized software, a two or three "
// "dimensional object is spatially mapped on the virtual program which mimics the "
// "real environment it is to be projected on. The software can interact with a "
// "projector to fit any desired image onto the surface of that object. This "
// "technique is used by artists and advertisers alike who can add extra dimensions, "
// "optical illusions, and notions of movement onto previously static objects. The "
// "video is commonly combined with, or triggered by, audio to create an "
// "audio-visual narrative."
// "This project was made possible by the support of the International Organization of "
// "La Francophonie.</p>"
// "<p>http://mapmap.info<br />"
// "http://www.francophonie.org</p>"
// ).arg(MM::VERSION, MM::COPYRIGHT_OWNERS));
_aboutDialog = new AboutDialog(this);
_aboutDialog->setAttribute(Qt::WA_DeleteOnClose); // Important for ressource management
_aboutDialog->show();
// Restart video playback. XXX Hack
videoTimer->start();
+4 -1
View File
@@ -58,6 +58,7 @@
MM_BEGIN_NAMESPACE
class PreferenceDialog;
class AboutDialog;
/**
* This is the main window of MapMap. It acts as both a view and a controller interface.
@@ -505,8 +506,10 @@ private:
QModelIndex currentSelectedIndex;
QTimer *videoTimer;
QElapsedTimer *systemTimer;
// Preference dialog
PreferenceDialog* _preferenceDialog;
// About dialog
AboutDialog *_aboutDialog;
// UndoStack
QUndoStack *undoStack;