From 3959f20237b7c6184e6cac1b16ea44fc86754968 Mon Sep 17 00:00:00 2001 From: markuspg Date: Thu, 22 Sep 2016 21:57:19 +0200 Subject: [PATCH] Reworked ORSEE display in a browser --- data/Labcontrol.conf | 4 +++- src/Lib/global.h | 4 ++-- src/Lib/lablib.cpp | 14 +++++++++----- src/mainwindow.cpp | 3 ++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/data/Labcontrol.conf b/data/Labcontrol.conf index 2840107..b2bf725 100644 --- a/data/Labcontrol.conf +++ b/data/Labcontrol.conf @@ -1,6 +1,8 @@ [General] # The user names of all users which shall be able to conduct administrative tasks with Labcontrol admin_users="UserA|UserB|UserC" +# The browser in which ORSEE shall be displayed +browser_command=/usr/bin/firefox # The port the client help server shall listen on client_help_server_port=XXXX # Client settings @@ -31,7 +33,7 @@ lpr_command=/usr/bin/lpr netstat_command=/bin/netstat network_broadcast_address=192.168.1.255 # A combination of an installed browser and the address of your lab's ORSEE -orsee_command=firefox http://yourORSEEserver.tld +orsee_url=http://yourORSEEserver.tld ping_command=/bin/ping postscript_viewer=/usr/bin/okular ps2pdf_command=/usr/bin/ps2pdf diff --git a/src/Lib/global.h b/src/Lib/global.h index b6b68ad..c41ce9a 100644 --- a/src/Lib/global.h +++ b/src/Lib/global.h @@ -22,9 +22,9 @@ #include -enum class settItms_t : unsigned short int { DVIPS_CMD, FILE_MANAGER, LC_INST_DIR, +enum class settItms_t : unsigned short int { BROWSER_CMD, DVIPS_CMD, FILE_MANAGER, LC_INST_DIR, LATEX_CMD, LOCAL_ZLEAF_NAME, LPR_CMD, NETSTAT_CMD, NETW_BRDCAST_ADDR, - ORSEE_COMMAND, PING_COMMAND, POSTSCRIPT_VIEWER, PS2PDF_COMMAND, + ORSEE_URL, PING_COMMAND, POSTSCRIPT_VIEWER, PS2PDF_COMMAND, SSH_KEY_ROOT, SSH_KEY_USER, RCP_CMD, RM_CMD, SERVER_IP, SSH_CMD, TERM_EMUL_CMD, USER_NAME_ON_CLIENTS, VNC_VIEWER, WAKEONLAN_CMD, WMCTRL_CMD, XSET_CMD, ZTREE_INST_DIR, SETT_ITMS_QUANT }; diff --git a/src/Lib/lablib.cpp b/src/Lib/lablib.cpp index 2dffdfd..af4d56b 100644 --- a/src/Lib/lablib.cpp +++ b/src/Lib/lablib.cpp @@ -144,6 +144,7 @@ void lc::Lablib::GotNetstatQueryResult( QStringList *argActiveZLeafConnections ) void lc::Lablib::ReadSettings() { QStringList simpleLoadableItems = { QStringList{} + << "browser_command" << "dvips_command" << "file_manager" << "labcontrol_installation_directory" @@ -171,6 +172,7 @@ void lc::Lablib::ReadSettings() { << "ztree_installation_directory" }; QStringList theItemsErrorComplaints = { QStringList{} + << "Opening ORSEE in a browser will not work." << "Receipts creation will not work." << "The display of preprints will not work." << "Labcontrol will missbehave with high propability." @@ -197,8 +199,9 @@ void lc::Lablib::ReadSettings() { << "Deactivating the screen saver on the clients will not be possible." << "zTree will not be available" }; - bool is_file[] = { true, true, true, true, false, true, true, false, false, true, true, true, true, - true, true, true, false, true, true, false, true, true, true, false, true }; + bool is_file[] = { true, true, true, true, true, false, true, true, false, false, + true, true, true, true, true, true, true, false, true, true, + false, true, true, true, false, true }; QString *tempItemStorage = nullptr; for ( int i = 0; i < ( int )settItms_t::SETT_ITMS_QUANT; i++ ) { @@ -409,14 +412,15 @@ void lc::Lablib::SetUserNameOnServer( const QString &argUserName ) { } void lc::Lablib::ShowOrsee() { - // Start the process QProcess showOrseeProcess; QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); showOrseeProcess.setProcessEnvironment( env ); - showOrseeProcess.startDetached( *( *settingsItems )[ ( int )settItms_t::ORSEE_COMMAND ] ); + QString program{ *( *settingsItems )[ ( int )settItms_t::BROWSER_CMD ] }; + QStringList arguments{ QStringList{} << *( *settingsItems )[ ( int )settItms_t::ORSEE_URL ] }; + showOrseeProcess.startDetached( program, arguments ); // Output message via the debug messages tab - debugMessagesTextEdit->appendPlainText( tr( "[DEBUG] %1" ).arg( *( *settingsItems )[ ( int )settItms_t::ORSEE_COMMAND ] ) ); + debugMessagesTextEdit->appendPlainText( tr( "[DEBUG] %1 %2" ).arg( program ).arg( arguments.join( " " ) ) ); } void lc::Lablib::ShowPreprints() { diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0133072..ddb8248 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -115,7 +115,8 @@ void lc::MainWindow::DisableDisfunctionalWidgets() { } // Disable 'PBShowORSEE', if 'orsee_command' was not set - if ( !lablib->GetSettingsItem( settItms_t::ORSEE_COMMAND ) ) { + if ( !lablib->GetSettingsItem( settItms_t::BROWSER_CMD ) + || !lablib->GetSettingsItem( settItms_t::ORSEE_URL ) ) { ui->PBShowORSEE->setEnabled( false ); }