From: Robert J. <spa...@us...> - 2004-05-17 21:15:57
|
Update of /cvsroot/lmuse/muse/muse In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3127/muse Modified Files: app.h conf.cpp gconfig.cpp help.cpp Log Message: Help system improved, should now adapt to the browser that is installed on the target system. Index: app.h =================================================================== RCS file: /cvsroot/lmuse/muse/muse/app.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** app.h 28 Apr 2004 22:00:51 -0000 1.32 --- app.h 17 May 2004 21:15:45 -0000 1.33 *************** *** 169,172 **** --- 169,173 ---- bool save(); void configGlobalSettings(); + void probeMachineSpecificConfiguration(); void quitDoc(); void about(); *************** *** 175,178 **** --- 176,180 ---- void startHomepageBrowser(); void startBugBrowser(); + void launchBrowser(QString &whereTo); void importMidi(); void importWave(); Index: gconfig.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/gconfig.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gconfig.cpp 21 Feb 2004 12:45:50 -0000 1.12 --- gconfig.cpp 17 May 2004 21:15:46 -0000 1.13 *************** *** 78,82 **** -60.0, // double minSlider; 20, // int guiRefresh; ! QString("konqueror"), true, // extendedMidi 384, // division for smf export --- 78,82 ---- -60.0, // double minSlider; 20, // int guiRefresh; ! QString(""), // helpBrowser true, // extendedMidi 384, // division for smf export Index: help.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/help.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** help.cpp 11 May 2004 21:18:55 -0000 1.5 --- help.cpp 17 May 2004 21:15:46 -0000 1.6 *************** *** 34,50 **** } } ! QString exe = QString("/bin/sh"); ! if(QFile::exists(exe)) ! { ! QProcess helper(this); ! helper.addArgument(exe); ! helper.addArgument("-c"); ! helper.addArgument(config.helpBrowser + " " + museHelp); ! helper.start(); ! } ! else ! { ! printf("Unable to launch help\n"); ! } } --- 34,38 ---- } } ! launchBrowser(museHelp); } *************** *** 57,73 **** QString museHome = QString("http://lmuse.sourceforge.net"); ! QString exe = QString("/bin/sh"); ! if(QFile::exists(exe)) ! { ! QProcess helper(this); ! helper.addArgument(exe); ! helper.addArgument("-c"); ! helper.addArgument(config.helpBrowser + " " + museHome); ! helper.start(); ! } ! else ! { ! printf("Unable to launch help\n"); ! } } --- 45,49 ---- QString museHome = QString("http://lmuse.sourceforge.net"); ! launchBrowser(museHome); } *************** *** 79,96 **** { QString museBugPage("http://lmuse.sourceforge.net/bugs.html"); ! ! QString exe = QString("/bin/sh"); ! if(QFile::exists(exe)) ! { ! QProcess helper(this); ! helper.addArgument(exe); ! helper.addArgument("-c"); ! helper.addArgument(config.helpBrowser + " " + museBugPage); ! helper.start(); ! } ! else ! { ! printf("Unable to launch help\n"); ! } } --- 55,59 ---- { QString museBugPage("http://lmuse.sourceforge.net/bugs.html"); ! launchBrowser(museBugPage); } *************** *** 115,117 **** } ! --- 78,110 ---- } ! 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)) ! { ! QProcess helper(this); ! helper.addArgument(exe); ! helper.addArgument("-c"); ! helper.addArgument(config.helpBrowser + " " + whereTo); ! helper.start(); ! } ! else ! { ! printf("Unable to launch help\n"); ! } ! ! } Index: conf.cpp =================================================================== RCS file: /cvsroot/lmuse/muse/muse/conf.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** conf.cpp 9 May 2004 13:00:36 -0000 1.30 --- conf.cpp 17 May 2004 21:15:46 -0000 1.31 *************** *** 376,379 **** --- 376,382 ---- if (debugMsg || debugMode) fprintf(stderr, "NO Config File <%s> found\n", configName.latin1()); + + // if the config file does not exist launch probeMachineSpecificConfiguration + probeMachineSpecificConfiguration(); return true; } *************** *** 963,964 **** --- 966,998 ---- } + //--------------------------------------------------------- + // probeMachineSpecificConfiguration + //--------------------------------------------------------- + void MusE::probeMachineSpecificConfiguration() + { + // set a default help browser (crude way to find out) + if (!system("which konqueror")) + { + config.helpBrowser = QString("konqueror"); + } + else if (!system("which opera")) + { + config.helpBrowser = QString("opera"); + } + else if (!system("which firebird")) + { + config.helpBrowser = QString("firebird"); + } + else if (!system("which mozilla")) + { + config.helpBrowser = QString("mozilla"); + } + else + { + // was not able to find a browser + } + + + + // More preconfiguration + } |