diff --git a/AboutDialog.cpp b/AboutDialog.cpp new file mode 100644 index 0000000..1cc8e1a --- /dev/null +++ b/AboutDialog.cpp @@ -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 . + */ + +#include "AboutDialog.h" + +#include + +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("

%1

").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 = "

" + tr("MapMap is a free/open source video mapping software.") + "

"; + // Copyright and software owners + QString copyrightText = "

" + tr("Copyright © 2013 %1.").arg(MM::COPYRIGHT_OWNERS) + "

"; + // 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 = "

" + tr("See the ") + QString("").arg(MM::ORGANIZATION_DOMAIN) + + tr("%1 website").arg(MM::APPLICATION_NAME) + " for more information on this software.

"; + // 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 diff --git a/AboutDialog.h b/AboutDialog.h new file mode 100644 index 0000000..8eea159 --- /dev/null +++ b/AboutDialog.h @@ -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 . + */ + +#ifndef ABOUTDIALOG_H +#define ABOUTDIALOG_H + +#include + +#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 diff --git a/MM.cpp b/MM.cpp index 9b11e73..d9268e1 100644 --- a/MM.cpp +++ b/MM.cpp @@ -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"; diff --git a/MainWindow.cpp b/MainWindow.cpp index f80ce54..3385078 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -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("

%1

" - "

Copyright © 2013 %2.

" - "

MapMap is a free software for video mapping.

" - "

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.

" - "

http://mapmap.info
" - "http://www.francophonie.org

" - ).arg(MM::VERSION, MM::COPYRIGHT_OWNERS)); +// // Pop-up about dialog. +// QMessageBox::about(this, tr("About MapMap"), +// tr("

%1

" +// "

Copyright © 2013 %2.

" +// "

MapMap is a free software for video mapping.

" +// "

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.

" +// "

http://mapmap.info
" +// "http://www.francophonie.org

" +// ).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(); diff --git a/MainWindow.h b/MainWindow.h index 884af7c..f08f351 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -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;