From 83192245a034537d334a7c168a8352fbbe610e58 Mon Sep 17 00:00:00 2001 From: lordmulder Date: Sat, 19 Mar 2011 18:16:23 +0100 Subject: [PATCH] Added entries for the documents to the menu. --- LameXP.vcproj | 18 ++++++++++++++++++ gui/MainWindow.ui | 33 +++++++++++++++++++++++++++++++++ res/Icons.qrc | 1 + src/Config.h | 2 +- src/Dialog_MainWindow.cpp | 38 ++++++++++++++++++++++++++++++++++++++ src/Dialog_MainWindow.h | 1 + 6 files changed, 92 insertions(+), 1 deletion(-) diff --git a/LameXP.vcproj b/LameXP.vcproj index 7fdf474d..b3aab64b 100644 --- a/LameXP.vcproj +++ b/LameXP.vcproj @@ -1754,6 +1754,10 @@ RelativePath=".\tmp\MOC_Tool_Abstract.cpp" > + + @@ -1778,6 +1782,20 @@ + + + + + diff --git a/gui/MainWindow.ui b/gui/MainWindow.ui index cfb09249..17a8d322 100644 --- a/gui/MainWindow.ui +++ b/gui/MainWindow.ui @@ -2728,6 +2728,10 @@ + + + + @@ -3031,6 +3035,33 @@ Disable Shell Integration + + + + :/icons/report.png:/icons/report.png + + + Frequently Asked Questions + + + + + + :/icons/report.png:/icons/report.png + + + Changelog + + + + + + :/icons/report.png:/icons/report.png + + + Translator's Guide + + @@ -3094,6 +3125,8 @@ + + diff --git a/res/Icons.qrc b/res/Icons.qrc index 1d4e07f5..de4098ec 100644 --- a/res/Icons.qrc +++ b/res/Icons.qrc @@ -62,6 +62,7 @@ icons/page_white_cd.png icons/paste_plain.png icons/play.png + icons/report.png icons/resultset_next.png icons/script.png icons/script_edit.png diff --git a/src/Config.h b/src/Config.h index 055edc1b..75d475d6 100644 --- a/src/Config.h +++ b/src/Config.h @@ -25,7 +25,7 @@ #define VER_LAMEXP_MAJOR 4 #define VER_LAMEXP_MINOR_HI 0 #define VER_LAMEXP_MINOR_LO 1 -#define VER_LAMEXP_BUILD 375 +#define VER_LAMEXP_BUILD 377 #define VER_LAMEXP_SUFFIX Beta-9 /* diff --git a/src/Dialog_MainWindow.cpp b/src/Dialog_MainWindow.cpp index eb632a82..458025e0 100644 --- a/src/Dialog_MainWindow.cpp +++ b/src/Dialog_MainWindow.cpp @@ -325,8 +325,14 @@ MainWindow::MainWindow(FileListModel *fileListModel, AudioFileModel *metaInfo, S connect(actionShowDropBoxWidget, SIGNAL(triggered(bool)), this, SLOT(showDropBoxWidgetActionTriggered(bool))); //Activate help menu actions + actionDocumentFAQ->setData(QString("%1/FAQ.html").arg(QApplication::applicationDirPath())); + actionDocumentChangelog->setData(QString("%1/Changelog.html").arg(QApplication::applicationDirPath())); + actionDocumentTranslate->setData(QString("%1/Translate.html").arg(QApplication::applicationDirPath())); connect(actionCheckUpdates, SIGNAL(triggered()), this, SLOT(checkUpdatesActionActivated())); connect(actionVisitHomepage, SIGNAL(triggered()), this, SLOT(visitHomepageActionActivated())); + connect(actionDocumentFAQ, SIGNAL(triggered()), this, SLOT(documentActionActivated())); + connect(actionDocumentChangelog, SIGNAL(triggered()), this, SLOT(documentActionActivated())); + connect(actionDocumentTranslate, SIGNAL(triggered()), this, SLOT(documentActionActivated())); //Center window in screen QRect desktopRect = QApplication::desktop()->screenGeometry(); @@ -1512,6 +1518,38 @@ void MainWindow::visitHomepageActionActivated(void) QDesktopServices::openUrl(QUrl(lamexp_website_url())); } +/* + * Show document + */ +void MainWindow::documentActionActivated(void) +{ + if(QAction *action = dynamic_cast(QObject::sender())) + { + if(action->data().isValid() && (action->data().type() == QVariant::String)) + { + QFileInfo document(action->data().toString()); + QFileInfo resource(QString(":/doc/%1.html").arg(document.baseName())); + if(document.exists() && document.isFile() && (document.size() == resource.size())) + { + QDesktopServices::openUrl(QUrl(QString("file:///%1").arg(document.canonicalFilePath()))); + } + else + { + QFile source(resource.filePath()); + QFile output(QString("%1/%2.%3.html").arg(lamexp_temp_folder2(), document.baseName(), lamexp_rand_str().left(8))); + if(source.open(QIODevice::ReadOnly) && output.open(QIODevice::ReadWrite)) + { + output.write(source.readAll()); + action->setData(output.fileName()); + source.close(); + output.close(); + QDesktopServices::openUrl(QUrl(QString("file:///%1").arg(output.fileName()))); + } + } + } + } +} + /* * Check for updates action */ diff --git a/src/Dialog_MainWindow.h b/src/Dialog_MainWindow.h index e3f91b37..e175d15b 100644 --- a/src/Dialog_MainWindow.h +++ b/src/Dialog_MainWindow.h @@ -70,6 +70,7 @@ private slots: void gotoMusicFolderButtonClicked(void); void checkUpdatesActionActivated(void); void visitHomepageActionActivated(void); + void documentActionActivated(void); void openFolderActionActivated(void); void notifyOtherInstance(void); void addFileDelayed(const QString &filePath);