Qt: Update desktop menus

This commit is contained in:
Sacha 2014-07-10 22:41:26 +10:00
parent 45ff37dc17
commit 10be547ec0
2 changed files with 27 additions and 8 deletions

View File

@ -25,6 +25,7 @@ MainWindow::MainWindow(QWidget *parent) :
memoryTexWindow(0),
displaylistWindow(0)
{
SetGameTitle("");
emugl = new MainUI(this);
setCentralWidget(emugl);
@ -362,9 +363,24 @@ void MainWindow::websiteAct()
QDesktopServices::openUrl(QUrl("http://www.ppsspp.org/"));
}
void MainWindow::forumAct()
{
QDesktopServices::openUrl(QUrl("http://forums.ppsspp.org/"));
}
void MainWindow::aboutAct()
{
QMessageBox::about(this, "PPSSPP Qt", QString::fromUtf8("Created by Henrik Rydg\xc3\xa5rd"));
QMessageBox::about(this, "About", QString::fromUtf8("PPSSPP Qt " PPSSPP_GIT_VERSION "\n\n"
"PSP emulator and debugger\n\n"
"Copyright (c) by Henrik Rydg\xc3\xa5rd and the PPSSPP Project 2012-\n"
"Qt port maintained by xSacha\n\n"
"Additional credits:\n"
" PSPSDK by #pspdev (freenode)\n"
" CISO decompression code by BOOSTER\n"
" zlib by Jean-loup Gailly (compression) and Mark Adler (decompression)\n"
" Qt project by Digia\n\n"
"All trademarks are property of their respective owners.\n"
"The emulator is for educational and development purposes only and it may not be used to play games you do not legally own."));
}
/* Private functions */
@ -384,7 +400,7 @@ void MainWindow::SetZoom(int zoom) {
void MainWindow::SetGameTitle(QString text)
{
QString title = "PPSSPP " + QString(PPSSPP_GIT_VERSION);
QString title = "PPSSPP " PPSSPP_GIT_VERSION;
if (text != "")
title += QString(" - %1").arg(text);
@ -395,14 +411,15 @@ void MainWindow::loadLanguage(const QString& language, bool translate)
{
if (currentLanguage != language)
{
currentLanguage = language;
QLocale::setDefault(QLocale(currentLanguage));
QLocale::setDefault(QLocale(language));
QApplication::removeTranslator(&translator);
currentLanguage = language;
if (translator.load(QString(":/languages/ppsspp_%1.qm").arg(language))) {
QApplication::installTranslator(&translator);
if (translate)
emit retranslate();
}
if (translate)
emit retranslate();
}
}
@ -576,7 +593,8 @@ void MainWindow::createMenus()
// Help
MenuTree* helpMenu = new MenuTree(this, menuBar(), QT_TR_NOOP("&Help"));
helpMenu->add(new MenuAction(this, SLOT(websiteAct()), QT_TR_NOOP("&Go to official website"), QKeySequence::HelpContents));
helpMenu->add(new MenuAction(this, SLOT(websiteAct()), QT_TR_NOOP("Official &website"), QKeySequence::HelpContents));
helpMenu->add(new MenuAction(this, SLOT(forumAct()), QT_TR_NOOP("Official &forum")));
helpMenu->add(new MenuAction(this, SLOT(aboutAct()), QT_TR_NOOP("&About PPSSPP..."), QKeySequence::WhatsThis));
retranslate();

View File

@ -128,6 +128,7 @@ private slots:
// Help
void websiteAct();
void forumAct();
void aboutAct();
// Others
@ -239,7 +240,7 @@ public:
QListIterator<int> i(valueList);
QListIterator<int> k(keyList);
foreach(QString name, nameList) {
new MenuAction(parent, this, i.next(), name, k.next());
new MenuAction(parent, this, i.next(), name, keyList.size() ? k.next() : 0);
}
connect(this, SIGNAL(triggered(QAction *)), parent, callback);
menu->addActions(this->actions());