diff --git a/CHANGELOG.md b/CHANGELOG.md
index fd9d7ef..2a9b80e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Added
### Changed
### Fixed
+- Initial port value not correctly set for z-Leaves started from main panel
### Removed
- Never properly implemented client webcam functionality
diff --git a/src/Lib/clienthelpnotificationserver.cpp b/src/Lib/clienthelpnotificationserver.cpp
index 11a4b6b..23be155 100644
--- a/src/Lib/clienthelpnotificationserver.cpp
+++ b/src/Lib/clienthelpnotificationserver.cpp
@@ -17,14 +17,18 @@
* along with Labcontrol. If not, see .
*/
+#include
+
#include "clienthelpnotificationserver.h"
+#include "settings.h"
+
+extern std::unique_ptr< lc::Settings > settings;
lc::ClientHelpNotificationServer::ClientHelpNotificationServer( const QMap< QString, Client* > * const argClientIPsToClientsMap,
- const QString &argServerIP, const unsigned short int &argServerPort, QObject *argParent ) :
+ QObject *argParent ) :
QObject{ argParent },
clientIPsToClientsMap{ argClientIPsToClientsMap },
- hostAddress{ argServerIP },
- serverPort{ argServerPort }
+ hostAddress{ settings->serverIP }
{
QNetworkConfigurationManager manager;
if ( manager.capabilities() & QNetworkConfigurationManager::NetworkSessionRequired ) {
@@ -69,7 +73,7 @@ void lc::ClientHelpNotificationServer::OpenSession() {
}
helpMessageServer = new QTcpServer{ this };
- if ( !helpMessageServer->listen( hostAddress, serverPort ) ) {
+ if ( !helpMessageServer->listen( hostAddress, settings->clientHelpNotificationServerPort ) ) {
QMessageBox messageBox{ QMessageBox::Critical, tr( "Unable to start the client help notification server" ),
tr( "Unable to start the client help notification server.\nThe following error occurred:\n\n%1." ).arg( helpMessageServer->errorString() ), QMessageBox::Ok };
messageBox.exec();
diff --git a/src/Lib/clienthelpnotificationserver.h b/src/Lib/clienthelpnotificationserver.h
index e525ffe..a7f7c64 100644
--- a/src/Lib/clienthelpnotificationserver.h
+++ b/src/Lib/clienthelpnotificationserver.h
@@ -33,7 +33,7 @@ class ClientHelpNotificationServer : public QObject {
Q_OBJECT
public:
explicit ClientHelpNotificationServer( const QMap< QString, Client* > * const argClientIPsToClientsMap,
- const QString &argServerIP, const unsigned short int &argServerPort, QObject *argParent = nullptr );
+ QObject *argParent = nullptr );
signals:
@@ -44,7 +44,6 @@ private:
QTcpServer *helpMessageServer = nullptr;
const QHostAddress hostAddress;
QNetworkSession *networkSession = nullptr;
- const unsigned short int serverPort = 0;
private slots:
void OpenSession();
diff --git a/src/Lib/lablib.cpp b/src/Lib/lablib.cpp
index 9d9642f..a7f5dd8 100644
--- a/src/Lib/lablib.cpp
+++ b/src/Lib/lablib.cpp
@@ -50,10 +50,8 @@ lc::Lablib::Lablib( QObject *argParent ) :
}
// Initialize the server for client help requests retrieval
- if ( clientHelpNotificationServerPort && !settings->serverIP.isEmpty() ) {
+ if ( settings->clientHelpNotificationServerPort && !settings->serverIP.isEmpty() ) {
clientHelpNotificationServer = new ClientHelpNotificationServer{ clientIPsToClientsMap,
- settings->serverIP,
- clientHelpNotificationServerPort,
this };
}
}
@@ -75,7 +73,7 @@ lc::Lablib::~Lablib () {
}
bool lc::Lablib::CheckIfUserIsAdmin() const {
- for ( const auto &s : adminUsers ) {
+ for ( const auto &s : settings->adminUsers ) {
if ( s == settings->localUserName ) {
qDebug() << "User" << settings->localUserName << "has administrative rights.";
return true;
@@ -85,23 +83,6 @@ bool lc::Lablib::CheckIfUserIsAdmin() const {
}
void lc::Lablib::DetectInstalledZTreeVersionsAndLaTeXHeaders() {
- // Detect the installed LaTeX headers
- if ( !settings->lcInstDir.isEmpty() ) {
- QDir laTeXDirectory{ settings->lcInstDir, "*header.tex", QDir::Name,
- QDir::CaseSensitive | QDir::Files | QDir::Readable };
- if ( !laTeXDirectory.exists() || laTeXDirectory.entryList().isEmpty() ) {
- QMessageBox messageBox{ QMessageBox::Critical, tr( "No LaTeX headers found" ),
- tr( "No LaTeX headers could be found in '%1'. Receipts printing will not work" )
- .arg( settings->lcInstDir ), QMessageBox::Ok };
- messageBox.exec();
- installedLaTeXHeaders = new QStringList{ "None found" };
- qDebug() << "No LaTeX headers could be found in" << settings->lcInstDir;
- } else {
- installedLaTeXHeaders = new QStringList{ laTeXDirectory.entryList() };
- installedLaTeXHeaders->replaceInStrings( "_header.tex", "" );
- qDebug() << "LaTeX headers:" << installedLaTeXHeaders->join( " / " );
- }
- }
}
void lc::Lablib::GotNetstatQueryResult( QStringList *argActiveZLeafConnections ) {
@@ -117,66 +98,6 @@ void lc::Lablib::GotNetstatQueryResult( QStringList *argActiveZLeafConnections )
}
void lc::Lablib::ReadSettings() {
- // Let the local zLeaf name default to 'local' if none was given in the settings
- if ( settings->GetLocalzLeafName().isEmpty() ) {
- settings->SetLocalzLeafName( tr( "local" ) );
- }
-
- // Read the list of users with administrative rights
- if ( !labSettings.contains( "admin_users" ) ) {
- QMessageBox messageBox{ QMessageBox::Information, tr( "'admin_users' not set" ),
- tr( "The 'admin_users' variable was not set. No users will be able to conduct administrative tasks." ) };
- messageBox.exec();
- qDebug() << "'admin_users' was not set. No permission for administrative tasks.";
- } else {
- adminUsers = labSettings.value( "admin_users", "" ).toString()
- .split( '|', QString::SkipEmptyParts, Qt::CaseInsensitive );
- qDebug() << "'adminUsers':" << adminUsers.join( " / " );
- }
-
- // Read the port the ClientHelpNotificationServer shall listen on
- clientHelpNotificationServerPort = labSettings.value( "client_help_server_port", 0 ).toUInt();
- if ( !clientHelpNotificationServerPort ) {
- QMessageBox messageBox{ QMessageBox::Information, tr( "The ClientHelpNotificationServer will be deactivated" ),
- tr( "The 'client_help_server_port' variable was not set or set to zero. The ClientHelpNotificationServer will be deactivated. Clients' help requests will be ignored by the server." ) };
- messageBox.exec();
- qDebug() << "The ClientHelpNotificationServer will be deactivated since"
- " 'client_help_server_port' was not set or set to zero.";
- } else {
- qDebug() << "'clientHelpNotificationServerPort':" << clientHelpNotificationServerPort;
- }
-
- // Read the default receipt index for the 'CBReceipts' combobox
- if ( !labSettings.contains( "default_receipt_index" ) ) {
- QMessageBox messageBox{ QMessageBox::Information, tr( "'default_receipt_index' not set" ),
- tr( "The 'default_receipt_index' variable was not set."
- " It will default to '0'." ) };
- messageBox.exec();
- qDebug() << "'default_receipt_index' was not set. It will default to '0'.";
- }
- defaultReceiptIndex = labSettings.value( "default_receipt_index", 0 ).toInt();
- qDebug() << "'defaultReceiptIndex':" << defaultReceiptIndex;
-
- // Read the initial port number
- if ( !labSettings.contains( "initial_port" ) ) {
- QMessageBox messageBox{ QMessageBox::Information, tr( "'initial_port' not set" ),
- tr( "The 'initial_port' variable was not set. Labcontrol will default to port 7000 for new zTree instances." ) };
- messageBox.exec();
- qDebug() << "'initial_port' was not set."
- " Labcontrol will default to port 7000 for new zTree instances.";
- }
- chosenZTreePort = labSettings.value( "initial_port", 7000 ).toInt();
- qDebug() << "'initial_port':" << chosenZTreePort;
-
- // Get a list of available webcams in the lab
- if ( !labSettings.contains( "webcams" ) ) {
- QMessageBox messageBox{ QMessageBox::Information, tr( "'webcams' not set" ),
- tr( "The 'webcams' variable was not set."
- " No stationary webcams will be available." ) };
- messageBox.exec();
- qDebug() << "'webcams' was not set. No stationary webcams will be available.";
- }
-
// Get the client quantity to check the value lists for clients creation for correct length
int clientQuantity = 0;
if ( !labSettings.contains("client_quantity" ) ) {
@@ -255,16 +176,6 @@ void lc::Lablib::ReadSettings() {
}
}
-void lc::Lablib::SetChosenZTreeDataTargetPath( const QString &argZTreeDataTargetPath ) {
- chosenZTreeDataTargetPath = argZTreeDataTargetPath;
- qDebug() << "'chosenZTreeDataTargetPath' set to:" << chosenZTreeDataTargetPath;
-}
-
-void lc::Lablib::SetChosenZTreePort( const int &argPort ) {
- chosenZTreePort = argPort;
- qDebug() << "'chosenZTreePort' set to:" << chosenZTreePort;
-}
-
void lc::Lablib::SetPrintReceiptsForLocalClients( const bool &argPrintReceiptsForLocalClients ) {
PrintReceiptsForLocalClients = argPrintReceiptsForLocalClients;
qDebug() << "Set 'PrintReceiptsForLocalClients' to:" << PrintReceiptsForLocalClients;
diff --git a/src/Lib/lablib.h b/src/Lib/lablib.h
index 09f1e6d..431bc86 100644
--- a/src/Lib/lablib.h
+++ b/src/Lib/lablib.h
@@ -71,21 +71,11 @@ public:
* \return True, if the account has administrative rights; false, otherwise
*/
bool CheckIfUserIsAdmin() const;
- /*! Returns the currently set port number of zTree
- *
- * @return The currently set port number for zTree
- */
- int GetChosenZTreePort() const { return chosenZTreePort; }
/** Returns a pointer to the clients known to Lablib
*
* @return A QVector of pointers to the Client class instances
*/
QVector< Client* > *GetClients () const { return clients; }
- /** Returns the default receipt index for the 'CBReceipts' combobox
- *
- * @return The default receipt index for the 'CBReceipts' combobox
- */
- int GetDefaultReceiptIndex () const { return defaultReceiptIndex; }
/** Returns a pointer to the QString storing the default name for local zLeafs
*
* @return A pointer to the QString storing the default name for local zLeafs
@@ -106,13 +96,6 @@ public:
* @return True if receipts for local clients shall be printed
*/
bool GetPrintReceiptsForLocalClients() const { return PrintReceiptsForLocalClients; }
- /** Returns a QStringList containing all available LaTeX headers of this system
- *
- * @return A pointer to a QStringList containing all available LaTeX headers
- */
- QStringList *GetInstalledLaTeXHeaders () const {return installedLaTeXHeaders; }
- void SetChosenZTreeDataTargetPath( const QString &argZTreeDataTargetPath );
- void SetChosenZTreePort( const int &argPort );
//! Sets the default name of local zLeaf instances
/**
* @param argName The default name local zLeaf instances shall have
@@ -141,15 +124,9 @@ private:
*/
void ReadSettings();
- QStringList adminUsers; //! Stores the names of all user accounts with administrative rights
- QString chosenZTreeDataTargetPath;
- int chosenZTreePort = 7000; //! Stores the currently chosen port for new zTree instances
ClientHelpNotificationServer *clientHelpNotificationServer = nullptr; //! A server to retrieve help requests from the clients
- unsigned short int clientHelpNotificationServerPort = 0; //! The port the help requests shall be received on
QMap< QString, Client* > * clientIPsToClientsMap = nullptr; //! A map container storing ip-client pairs
QVector *clients = nullptr; //! A QVector storing pointers to all Client instances
- int defaultReceiptIndex = 0; //! Stores the index of the LaTeX header to be displayed by default
- QStringList *installedLaTeXHeaders = nullptr;
QSettings labSettings;
NetstatAgent *netstatAgent = nullptr; //! Tries to detect active zLeaf connections from the clients
QThread netstatThread;
diff --git a/src/Lib/settings.cpp b/src/Lib/settings.cpp
index b9282f4..75e2ccb 100644
--- a/src/Lib/settings.cpp
+++ b/src/Lib/settings.cpp
@@ -1,3 +1,22 @@
+/*
+ * Copyright 2014-2016 Markus Prasser
+ *
+ * This file is part of Labcontrol.
+ *
+ * Labcontrol is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Labcontrol is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Labcontrol. If not, see .
+ */
+
#include
#include
#include
@@ -7,6 +26,7 @@
lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
QObject{ argParent },
+ defaultReceiptIndex{ GetDefaultReceiptIndex( argSettings ) },
browserCmd{ ReadSettingsItem( "browser_command",
"Opening ORSEE in a browser will not work.",
argSettings, true ) },
@@ -97,12 +117,25 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
zTreeInstDir{ ReadSettingsItem( "ztree_installation_directory",
"zTree will not be available.",
argSettings, true ) },
+ adminUsers{ GetAdminUsers( argSettings ) },
+ installedLaTeXHeaders{ DetectInstalledLaTeXHeaders() },
installedZTreeVersions{ DetectInstalledzTreeVersions() },
+ clientHelpNotificationServerPort{ GetClientHelpNotificationServerPort( argSettings ) },
+ chosenzTreePort{ GetInitialPort( argSettings ) },
localzLeafName{ ReadSettingsItem( "local_zLeaf_name",
"The local zLeaf default name will default to 'local'.",
argSettings, false ) }
{
- qDebug() << "The following webcams where loaded:" << webcams;
+ // Let the local zLeaf name default to 'local' if none was given in the settings
+ if ( localzLeafName.isEmpty() ) {
+ qDebug() << "'local_zLeaf_name' was not set, defaulting to 'local'";
+ localzLeafName = "local";
+ }
+ if ( webcams.isEmpty() ) {
+ qDebug() << "'webcams' was not properly set. No stationary webcams will be available.";
+ } else {
+ qDebug() << "The following webcams where loaded:" << webcams;
+ }
qDebug() << "Detected z-Tree versions" << installedZTreeVersions;
}
@@ -117,6 +150,24 @@ bool lc::Settings::CheckPathAndComplain( const QString &argPath, const QString &
return true;
}
+QStringList lc::Settings::DetectInstalledLaTeXHeaders() const {
+ QStringList tempLaTeXHeaders{ "None found" };
+ // Detect the installed LaTeX headers
+ if ( !lcInstDir.isEmpty() ) {
+ QDir laTeXDirectory{ lcInstDir, "*_header.tex", QDir::Name,
+ QDir::CaseSensitive | QDir::Files | QDir::Readable };
+ if ( !laTeXDirectory.exists() || laTeXDirectory.entryList().isEmpty() ) {
+ qDebug() << "Receipts printing will not work. No LaTeX headers could be found in"
+ << lcInstDir;
+ } else {
+ tempLaTeXHeaders = laTeXDirectory.entryList();
+ tempLaTeXHeaders.replaceInStrings( "_header.tex", "" );
+ qDebug() << "LaTeX headers:" << tempLaTeXHeaders.join( " / " );
+ }
+ }
+ return tempLaTeXHeaders;
+}
+
QStringList lc::Settings::DetectInstalledzTreeVersions() const {
QStringList tempInstzTreeVersions;
if ( !zTreeInstDir.isEmpty() ) {
@@ -133,6 +184,59 @@ QStringList lc::Settings::DetectInstalledzTreeVersions() const {
return tempInstzTreeVersions;
}
+QStringList lc::Settings::GetAdminUsers( const QSettings &argSettings ) {
+ // Read the list of users with administrative rights
+ if ( !argSettings.contains( "admin_users" ) ) {
+ qDebug() << "The 'admin_users' variable was not set."
+ " No users will be able to conduct administrative tasks.";
+ return QStringList{};
+ } else {
+ QStringList adminUsers{ argSettings.value( "admin_users", "" ).toString()
+ .split( '|', QString::SkipEmptyParts, Qt::CaseInsensitive ) };
+ qDebug() << "'adminUsers':" << adminUsers.join( " / " );
+ return adminUsers;
+ }
+ return QStringList{};
+}
+
+quint16 lc::Settings::GetClientHelpNotificationServerPort( const QSettings &argSettings ) {
+ // Read the port the ClientHelpNotificationServer shall listen on
+ quint16 clientHelpNotificationServerPort = argSettings.value( "client_help_server_port",
+ 0 ).toUInt();
+ if ( !clientHelpNotificationServerPort ) {
+ qDebug() << "The 'client_help_server_port' variable was not set or set to zero."
+ " The ClientHelpNotificationServer will be deactivated therefore."
+ " Clients' help requests will be ignored by the server.";
+ return 0;
+ } else {
+ qDebug() << "'clientHelpNotificationServerPort':" << clientHelpNotificationServerPort;
+ return clientHelpNotificationServerPort;
+ }
+ return 0;
+}
+
+int lc::Settings::GetDefaultReceiptIndex( const QSettings &argSettings ) {
+ // Read the default receipt index for the 'CBReceipts' combobox
+ if ( !argSettings.contains( "default_receipt_index" ) ) {
+ qDebug() << "'default_receipt_index' was not set. It will default to '0'.";
+ return 0;
+ }
+ int tempIndex = argSettings.value( "default_receipt_index", 0 ).toInt();
+ qDebug() << "'defaultReceiptIndex':" << tempIndex;
+ return tempIndex;
+}
+
+int lc::Settings::GetInitialPort( const QSettings &argSettings ) {
+ // Read the initial port number
+ if ( !argSettings.contains( "initial_port" ) ) {
+ qDebug() << "The 'initial_port' variable was not set."
+ " Labcontrol will default to port 7000 for new zTree instances.";
+ }
+ int initialPort = argSettings.value( "initial_port", 7000 ).toInt();
+ qDebug() << "'initial_port':" << initialPort;
+ return initialPort;
+}
+
QString lc::Settings::GetLocalUserName() {
const QProcessEnvironment env{ QProcessEnvironment::systemEnvironment() };
QString userName;
diff --git a/src/Lib/settings.h b/src/Lib/settings.h
index 62a2952..fb47629 100644
--- a/src/Lib/settings.h
+++ b/src/Lib/settings.h
@@ -1,6 +1,26 @@
+/*
+ * Copyright 2014-2016 Markus Prasser
+ *
+ * This file is part of Labcontrol.
+ *
+ * Labcontrol is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Labcontrol is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Labcontrol. If not, see .
+ */
+
#ifndef SETTINGS_H
#define SETTINGS_H
+#include
#include
#include
@@ -17,9 +37,12 @@ public:
Settings( Settings &&argSettings ) = delete;
Settings& operator=( Settings &&argSettings ) = delete;
+ int GetChosenZTreePort() const { return chosenzTreePort; }
QString GetLocalzLeafName() const;
+ void SetChosenZTreePort( const int argPort );
void SetLocalzLeafName( const QString &argLocalzLeafName );
+ const int defaultReceiptIndex = 0;
const QString browserCmd;
const QString dvipsCmd;
const QString fileMngr;
@@ -51,18 +74,27 @@ public:
const QString wmctrlCmd;
const QString xsetCmd;
const QString zTreeInstDir;
+ const QStringList adminUsers;
+ const QStringList installedLaTeXHeaders;
const QStringList installedZTreeVersions;
+ const quint16 clientHelpNotificationServerPort = 0;
private:
static bool CheckPathAndComplain( const QString &argPath, const QString &argVariableName,
const QString &argMessage );
+ QStringList DetectInstalledLaTeXHeaders() const;
QStringList DetectInstalledzTreeVersions() const;
+ static QStringList GetAdminUsers( const QSettings &argSettings );
+ static quint16 GetClientHelpNotificationServerPort( const QSettings &argSettings );
+ static int GetDefaultReceiptIndex( const QSettings &argSettings );
+ static int GetInitialPort( const QSettings &argSettings );
static QString GetLocalUserName();
static QString ReadSettingsItem( const QString &argVariableName,
const QString &argMessage,
const QSettings &argSettings,
bool argItemIsFile );
+ int chosenzTreePort = 0;
QString localzLeafName;
};
@@ -72,6 +104,11 @@ inline QString lc::Settings::GetLocalzLeafName() const {
return localzLeafName;
}
+inline void lc::Settings::SetChosenZTreePort( const int argPort ) {
+ chosenzTreePort = argPort;
+ qDebug() << "'chosenZTreePort' set to:" << chosenzTreePort;
+}
+
inline void lc::Settings::SetLocalzLeafName( const QString &argLocalzLeafName ) {
localzLeafName = argLocalzLeafName;
}
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index fa6e4a5..5ab86e6 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -605,6 +605,8 @@ void lc::MainWindow::on_RBUseLocalUser_toggled(bool checked) {
}
void lc::MainWindow::SetupWidgets() {
+ // Set the correct initial port for the
+ ui->SBzLeafPort->setValue( settings->GetChosenZTreePort() );
// Fill the 'CBClientNames' with possible client names and the 'TVClients' with the clients
const QVector< Client* > *clients = lablib->GetClients();
if ( !( clients == nullptr ) ) {
diff --git a/src/sessionstarter.cpp b/src/sessionstarter.cpp
index c2a74b7..0e07117 100644
--- a/src/sessionstarter.cpp
+++ b/src/sessionstarter.cpp
@@ -56,12 +56,13 @@ void lc::SessionStarter::GetNewDataTargetPath() {
}
void lc::SessionStarter::on_CBDataTargetPath_activated(const QString &arg1) {
+ Q_UNUSED( arg1 );
+
if ( ui->CBDataTargetPath->currentIndex() == 0 ) {
emit NewDataTargetPathRequested();
return;
}
ui->CBDataTargetPath->setStyleSheet( "" );
- lablib->SetChosenZTreeDataTargetPath( arg1 );
}
void lc::SessionStarter::on_CBReceiptsHeader_activated( const QString &argHeader ) {
@@ -104,11 +105,11 @@ void lc::SessionStarter::on_PBStartzTree_clicked() {
void lc::SessionStarter::on_SBPort_editingFinished() {
ui->SBPort->setStyleSheet( "" );
- lablib->SetChosenZTreePort( ui->SBPort->value() );
+ settings->SetChosenZTreePort( ui->SBPort->value() );
}
void lc::SessionStarter::SetupWidgets() {
- ui->SBPort->setValue( lablib->GetChosenZTreePort() );
+ ui->SBPort->setValue( settings->GetChosenZTreePort() );
// Fill the 'CBzTreeVersion' combobox with known entries from the lablib class
ui->CBzTreeVersion->addItem( "NONE" );
@@ -122,23 +123,22 @@ void lc::SessionStarter::SetupWidgets() {
throw lcForbiddenCall{};
}
- // Fill the 'CBReceipts' combobox with known entries from the lablib class
- const QStringList *laTeXHeaders = lablib->GetInstalledLaTeXHeaders();
- if ( laTeXHeaders ) {
- if ( ( laTeXHeaders->count() == 1 ) && ( laTeXHeaders->at(0) == "None found" ) ) {
+ // Fill the 'CBReceipts' combobox with successfully detected LaTeX receipt headers
+ if ( !settings->installedLaTeXHeaders.isEmpty() ) {
+ if ( ( settings->installedLaTeXHeaders.count() == 1 )
+ && ( settings->installedLaTeXHeaders.at(0) == "None found" ) ) {
ui->GBReceipts->setEnabled( false );
}
- ui->CBReceiptsHeader->addItems( *laTeXHeaders );
- if ( laTeXHeaders->length() - 1 < lablib->GetDefaultReceiptIndex() ) {
+ ui->CBReceiptsHeader->addItems( settings->installedLaTeXHeaders );
+ if ( settings->installedLaTeXHeaders.length() - 1 < settings->defaultReceiptIndex ) {
QMessageBox::information( this, tr( "'default_receipt_index' to high" ),
tr( "'default_receipt_index' was set to big. The combo box containing the receipt templates will default to the first entry." ) );
qDebug() << "'default_receipt_index' was set to big."
" The combo box containing the receipt templates will default to the first entry.";
ui->CBReceiptsHeader->setCurrentIndex( 0 );
} else {
- ui->CBReceiptsHeader->setCurrentIndex( lablib->GetDefaultReceiptIndex() );
+ ui->CBReceiptsHeader->setCurrentIndex( settings->defaultReceiptIndex );
}
- laTeXHeaders = nullptr;
}
// Fill the 'CBDataTargetPath' combobox with some data target path examples
@@ -149,9 +149,6 @@ void lc::SessionStarter::SetupWidgets() {
connect( this, &SessionStarter::NewDataTargetPathRequested,
this, &SessionStarter::GetNewDataTargetPath );
- // Since filling a QComboBox does not emit the 'activated' signal, initially set some variables manually
- lablib->SetChosenZTreeDataTargetPath( ui->CBDataTargetPath->currentText() );
-
// Set the initial status of CBReceiptsforLocalClients according to the settings in lcLablib
ui->ChBReceiptsforLocalClients->setChecked( lablib->GetPrintReceiptsForLocalClients() );
}