Skip to content

Commit

Permalink
Changed the layout of the About dialog.
Browse files Browse the repository at this point in the history
  • Loading branch information
punesemu committed Jan 7, 2024
1 parent b1b3645 commit 022a824
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 49 deletions.
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ set(gui_srcs
gui/cgp.cpp
gui/cmd_line.cpp
gui/dipswitch.cpp
gui/dlgAbout.cpp
gui/dlgAbout.hpp
gui/dlgCmdLineHelp.cpp
gui/dlgCmdLineHelp.hpp
gui/dlgDetachBarcode.cpp
Expand Down
81 changes: 81 additions & 0 deletions src/gui/designer/dlgAbout.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dlgAbout</class>
<widget class="QDialog" name="dlgAbout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>151</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">About</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_dlgAbout">
<property name="spacing">
<number>24</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_Icon_Text">
<property name="spacing">
<number>24</number>
</property>
<item>
<widget class="QLabel" name="icon_About">
<property name="text">
<string notr="true">Icon</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_Text">
<property name="spacing">
<number>12</number>
</property>
<item>
<widget class="QLabel" name="label_Text">
<property name="text">
<string notr="true">Text</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_Informative">
<property name="text">
<string notr="true">Informative</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="pushButton_Ok">
<property name="text">
<string notr="true">Ok</string>
</property>
<property name="icon">
<iconset resource="resources.qrc">
<normaloff>:/icon/icons/confirm.svgz</normaloff>:/icon/icons/confirm.svgz</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="resources.qrc"/>
</resources>
<connections/>
</ui>
96 changes: 84 additions & 12 deletions src/gui/designer/translations/en_EN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,21 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dlgAbout</name>
<message>
<source>portable version</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Nintendo Entertainment System Emulator</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Compiled</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dlgCfgNSCode</name>
<message>
Expand Down Expand Up @@ -952,6 +967,10 @@
<source>None</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>which Floppy Disk image do you want to load?</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>dlgVsSystem</name>
Expand Down Expand Up @@ -1181,18 +1200,6 @@
<source>Open save state</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Nintendo Entertainment System Emulator</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Compiled</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>portable version</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>&amp;Open</source>
<translation type="unfinished"></translation>
Expand Down Expand Up @@ -1618,6 +1625,66 @@
<source>Floppy Disk image files</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Warning</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>This rom requires unsupported hardware to function correctly.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open FLoppy Disk Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>FDS Format Disk</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Quick Disk Format Disk</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>puNES image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Exports the current state of the disk</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Error on export state</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Impossible write %0.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>to &amp;FDS Format (with Header)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>to &amp;Quick Disk Format</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>to puNES image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>to F&amp;DS Format (without Header)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>C&amp;hange Disk</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>E&amp;xport current state of Disk/Disks</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>nesKeyboardStatusBar</name>
Expand Down Expand Up @@ -1855,6 +1922,11 @@
<extracomment>Do not translate the words contained between parentheses (example: [red] or [normal]) are tags that have a specific meaning and do not traslate %1 and %2</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<source>auto switch [red]disabled[normal], single-sided disk</source>
<extracomment>Do not translate the words contained between parentheses (example: [red] or [normal]) are tags that have a specific meaning and do not traslate %1 and %2</extracomment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>recStatusBar</name>
Expand Down
82 changes: 82 additions & 0 deletions src/gui/dlgAbout.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* Copyright (C) 2010-2023 Fabio Cavallo (aka FHorse)
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#include <QtCore/QDateTime>
#include <QtCore/QEvent>
#include <QtGui/QIcon>
#include <QtGui/QPainter>
#include "dlgAbout.hpp"
#include "version.h"
#include "info.h"

dlgAbout::dlgAbout(QWidget *parent) : QDialog(parent) {
QDateTime compiled = QDateTime::fromString(COMPILED, "MMddyyyyhhmmss");
QString text;

setupUi(this);

setAttribute(Qt::WA_DeleteOnClose);

if (font().pointSize() > 9) {
QFont font;

font.setPointSize(9);
setFont(font);
}

setWindowTitle(QString(NAME));
setWindowModality(Qt::WindowModal);

setWindowIcon(QIcon(":/icon/icons/application.png"));
icon_About->setPixmap(QPixmap(":/pics/pics/punes_banner.png"));

text.append("<center><h2>" + QString(NAME) + " ");
if (info.portable) {
text.append(tr("portable version") + " ");
}
text.append(QString(VERSION) + "</h2></center>");

#if defined (WITH_GIT_INFO)
text.append("<center><h4>[<font color='#800000'>Commit " + QString(GIT_COUNT_COMMITS) + "</font> " + "<a href=\"https://github.com/punesemu/puNES/commit/" + QString(GIT_LAST_COMMIT_HASH) + "\">" + QString(GIT_LAST_COMMIT) + "</a>]</h4></center>");
#endif
text.append("<center>" + tr("Nintendo Entertainment System Emulator") + "</center>");
text.append("<center>" + tr("Compiled") + " " + QLocale().toString(compiled, QLocale::ShortFormat) + " (" + QString(ENVIRONMENT));
text.append(", " + QString(VERTYPE) + ")</center>");
label_Text->setText(text);

text = "<center>" + QString(COPYRUTF8) + "</center>\n";
text.append("<center><a href=\"" + QString(GITLAB) + "\">" + "GitLab Page</a></center>");
text.append("<center><a href=\"" + QString(GITHUB) + "\">" + "GitHub Page</a></center>");
text.append("<center><a href=\"" + QString(WEBSITE) + "\">" + "NesDev Forum</a></center>");
label_Informative->setText(text);

connect(pushButton_Ok, SIGNAL(clicked(bool)), this, SLOT(s_ok_clicked(bool)));
}
dlgAbout::~dlgAbout() = default;

void dlgAbout::changeEvent(QEvent *event) {
if (event->type() == QEvent::LanguageChange) {
retranslateUi(this);
} else {
QDialog::changeEvent(event);
}
}

void dlgAbout::s_ok_clicked(UNUSED(bool checked)) {
close();
}
40 changes: 40 additions & 0 deletions src/gui/dlgAbout.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) 2010-2023 Fabio Cavallo (aka FHorse)
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef DLGABOUT_HPP_
#define DLGABOUT_HPP_

#include <QtWidgets/QDialog>
#include "ui_dlgAbout.h"
#include "common.h"

class dlgAbout : public QDialog, public Ui::dlgAbout {
Q_OBJECT

public:
explicit dlgAbout(QWidget *parent = nullptr);
~dlgAbout() override;

protected:
void changeEvent(QEvent *event) override;

private slots:
void s_ok_clicked(bool checked);
};

#endif /* DLGABOUT_HPP_ */
Loading

0 comments on commit 022a824

Please sign in to comment.