diff options
author | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
---|---|---|
committer | Robert Jonsson <spamatica@gmail.com> | 2010-10-13 19:34:22 +0000 |
commit | 8a2c2824a59d7644e13bc52c9a0ecbd641f21f95 (patch) | |
tree | 064ad3f2bf8daab0ad27b128abd86a9bbdb1e496 /muse2/muse/help.cpp | |
parent | a27706d9629e8b592cca4659f865b70adef24e6d (diff) |
new branch muse2, first checkin
Diffstat (limited to 'muse2/muse/help.cpp')
-rw-r--r-- | muse2/muse/help.cpp | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/muse2/muse/help.cpp b/muse2/muse/help.cpp new file mode 100644 index 00000000..82d900f1 --- /dev/null +++ b/muse2/muse/help.cpp @@ -0,0 +1,112 @@ +//========================================================= +// MusE +// Linux Music Editor +// $Id: help.cpp,v 1.7.2.4 2009/07/05 23:06:21 terminator356 Exp $ +// +// (C) Copyright 1999/2000 Werner Schweer (ws@seh.de) +//========================================================= + +#include <unistd.h> +#include <stdlib.h> +#include <qmessagebox.h> +#include <q3process.h> + +#include "app.h" +#include "globals.h" +#include "gconfig.h" +#include "icons.h" +#include "aboutbox_impl.h" + +//--------------------------------------------------------- +// startHelpBrowser +//--------------------------------------------------------- + +void MusE::startHelpBrowser() + { + QString lang(getenv("LANG")); + QString museHelp = museGlobalShare + QString("/html/index_") + lang + QString(".html"); + if (access(museHelp.latin1(), R_OK) != 0) { + museHelp = museGlobalShare + QString("/html/index.html"); + if (access(museHelp.latin1(), R_OK) != 0) { + QString info(tr("no help found at: ")); + info += museHelp; + QMessageBox::critical(this, tr("MusE: Open Help"), info); + return; + } + } + launchBrowser(museHelp); + } + +//--------------------------------------------------------- +// startHelpBrowser +//--------------------------------------------------------- + +void MusE::startHomepageBrowser() + { + QString museHome = QString("http://www.muse-sequencer.org"); + + launchBrowser(museHome); + } + +//--------------------------------------------------------- +// startBugBrowser +//--------------------------------------------------------- + +void MusE::startBugBrowser() + { + //QString museBugPage("http://www.muse-sequencer.org/wiki/index.php/Report_a_bug"); + QString museBugPage("http://www.muse-sequencer.org/index.php/Report_a_bug"); + launchBrowser(museBugPage); + } + +//--------------------------------------------------------- +// about +//--------------------------------------------------------- + +void MusE::about() + { + AboutBoxImpl ab; + ab.show(); + ab.exec(); + } + +//--------------------------------------------------------- +// aboutQt +//--------------------------------------------------------- + +void MusE::aboutQt() + { + QMessageBox::aboutQt(this, QString("MusE")); + } + +void MusE::launchBrowser(QString &whereTo) + { + char testStr[40]; + strcpy(testStr, "which "); + strcat(testStr, config.helpBrowser.latin1()); + if (config.helpBrowser == "" || system(testStr)) + { + QMessageBox::information( this, "Unable to launch help", + "For some reason MusE has failed to detect or launch\n" + "a browser on your machine. Please go to Settings->Global Settings->GUI\n" + "and insert the program name of your favourite browser.", + "Ok", + 0 ); + return; + } + + QString exe = QString("/bin/sh"); + if(QFile::exists(exe)) + { + Q3Process helper(this); + helper.addArgument(exe); + helper.addArgument("-c"); + helper.addArgument(config.helpBrowser + " " + whereTo); + helper.start(); + } + else + { + printf("Unable to launch help\n"); + } + + } |