-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* | ||
* Citybuilding Mappers - create minimaps from citybuilding game files | ||
* Copyright (C) 2007, 2008 Bianca van Schaik | ||
* | ||
* 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 2 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, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
#include "helpdialog.h" | ||
|
||
#include <QTextEdit> | ||
#include <QPushButton> | ||
#include <QVBoxLayout> | ||
#include <QHBoxLayout> | ||
#include <QFont> | ||
|
||
HelpDialog::HelpDialog(QWidget *parent, const QString &appname) | ||
: QDialog(parent) { | ||
|
||
this->appname = appname; | ||
|
||
setWindowTitle(appname + tr(" Help")); | ||
|
||
// Create textedit | ||
QTextEdit *textEdit = new QTextEdit(); | ||
textEdit->setReadOnly(true); | ||
textEdit->setWordWrapMode(QTextOption::WordWrap); | ||
textEdit->setPlainText(getHelpText()); | ||
textEdit->setMinimumSize(480, 300); | ||
|
||
// Create ok button | ||
QPushButton *okButton = new QPushButton(tr("OK"), this); | ||
okButton->setDefault(true); | ||
connect(okButton, SIGNAL(clicked()), this, SLOT(close())); | ||
|
||
QHBoxLayout *buttonLayout = new QHBoxLayout(); | ||
buttonLayout->addStretch(); | ||
buttonLayout->addWidget(okButton); | ||
buttonLayout->addStretch(); | ||
|
||
QVBoxLayout *layout = new QVBoxLayout(); | ||
layout->addWidget(textEdit); | ||
layout->addLayout(buttonLayout); | ||
|
||
setLayout(layout); | ||
setModal(true); | ||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); | ||
} | ||
|
||
QString HelpDialog::getHelpText() { | ||
QString text = tr( | ||
"This program can open the .sg2 and .sg3 files that were used in " | ||
"the citybuilding games from Impressions Games.\n\n" | ||
"Loading a single SG file:\n" | ||
"Open a .sg2/.sg3 file and a tree of images will appear to the left. " | ||
"Click any image to show it on the right. Use the File menu to save the " | ||
"image as PNG.\n\n" | ||
"Batch-extraction:\n" | ||
"To extract all images in one go, use File -> Batch Extract. " | ||
"Select a directory where SG files are stored, select a destination, " | ||
"and all images will be extracted.\n\n" | ||
"SG files contain multiple images, usually thousands. The SG file itself acts as a " | ||
"dictionary for all the images, the actual pixels are stored in " | ||
"the .555 files that are also present in the games.\n\n"); | ||
|
||
return text; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Citybuilding Mappers - create minimaps from citybuilding game files | ||
* Copyright (C) 2007, 2008 Bianca van Schaik | ||
* | ||
* 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 2 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, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
#ifndef HELPDIALOG_H | ||
#define HELPDIALOG_H | ||
|
||
#include <QDialog> | ||
#include <QString> | ||
|
||
class HelpDialog : public QDialog { | ||
public: | ||
/** | ||
* Constructor, constructs a new help dialog | ||
* @param parent Parent widget | ||
* @param appname Name of the application, used in the title bar | ||
*/ | ||
HelpDialog(QWidget *parent, const QString & appname); | ||
|
||
private: | ||
QString getHelpText(); | ||
|
||
QString appname; | ||
}; | ||
|
||
#endif /* HELPDIALOG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
#include "mainwindow.h" | ||
#include "imagetreeitem.h" | ||
#include "aboutdialog.h" | ||
#include "helpdialog.h" | ||
#include "licencedialog.h" | ||
#include "gui/extractwizard.h" | ||
|
||
|
@@ -59,6 +60,11 @@ void MainWindow::licence() { | |
dialog.exec(); | ||
} | ||
|
||
void MainWindow::help() { | ||
HelpDialog dialog(this, appname); | ||
dialog.exec(); | ||
} | ||
|
||
void MainWindow::about() { | ||
AboutDialog dialog(this, appname, QString("1.1 (2019-01-12)"), | ||
tr("Copyright (C) 2007-2020 Bianca van Schaik <[email protected]>"), | ||
|
@@ -112,8 +118,7 @@ void MainWindow::loadFile(const QString &filename) { | |
// Just have a long list of images | ||
int numImages = sgFile->totalImageCount(); | ||
for (int i = 0; i < numImages; i++) { | ||
QTreeWidgetItem *item = new ImageTreeItem(treeWidget, i, | ||
sgFile->image(i)); | ||
new ImageTreeItem(treeWidget, i, sgFile->image(i)); | ||
} | ||
} else { | ||
// Split up by file | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters