Also moved 'webcams' variable entirely into 'lc::Settings'

remotes/origin/HEAD
markuspg 8 years ago
parent 3441f032a5
commit 01855a637b

@ -73,7 +73,6 @@ lc::Lablib::~Lablib () {
delete clients;
delete InstalledZTreeVersions;
delete occupiedPorts;
delete webcams;
}
bool lc::Lablib::CheckIfUserIsAdmin() const {
@ -197,10 +196,6 @@ void lc::Lablib::ReadSettings() {
messageBox.exec();
debugMessagesTextEdit->appendPlainText( tr( "[DEBUG] 'webcams' was not set. No stationary webcams will be available." ) );
}
else {
webcams = new QStringList{ labSettings.value( "webcams" ).toString().split( '|', QString::SkipEmptyParts, Qt::CaseInsensitive ) };
debugMessagesTextEdit->appendPlainText( tr( "[DEBUG] 'webcams': %1" ).arg( webcams->join( " / " ) ) );
}
// Get the client quantity to check the value lists for clients creation for correct length
int clientQuantity = 0;

@ -117,11 +117,6 @@ public:
* @return A pointer to a QStringList containing all available zTree versions
*/
QStringList *GetInstalledZTreeVersions () const { return InstalledZTreeVersions; }
/** Returns a pointer to a QStringList containing all available webcams
*
* @return A pointer to a QStringList containing all available webcams
*/
QStringList *GetWebcams () const { return webcams; }
void SetChosenZTreeDataTargetPath( const QString &argZTreeDataTargetPath );
void SetChosenZTreePort( const int &argPort );
//! Sets the default name of local zLeaf instances
@ -170,7 +165,6 @@ private:
QVector< int > *occupiedPorts = nullptr;
bool PrintReceiptsForLocalClients = true;
SessionsModel *sessionsModel = nullptr; //! A derivation from QAbstractTableModel used to store the single Session instances
QStringList *webcams = nullptr; //! A QStringList containing all available stationary webcams in the laboratory
};
}

@ -76,6 +76,8 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
wakeonlanCmd{ ReadSettingsItem( "wakeonlan_command",
"Booting the clients will not work.",
argSettings, true ) },
webcams{ argSettings.value( "webcams", "" ).toString().split( '|', QString::SkipEmptyParts,
Qt::CaseInsensitive ) },
wineCmd{ ReadSettingsItem( "wine_command",
"Running z-Leaves or z-Tree will be possible.",
argSettings, true ) },
@ -92,6 +94,7 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
"The local zLeaf default name will default to 'local'.",
argSettings, false ) }
{
qDebug() << "The following webcams where loaded:" << webcams;
}
bool lc::Settings::CheckPathAndComplain( const QString &argPath, const QString &argVariableName,

@ -44,6 +44,7 @@ public:
const QString userNameOnClients;
const QString vncViewer;
const QString wakeonlanCmd;
const QStringList webcams;
const QString wineCmd;
const QString wmctrlCmd;
const QString xsetCmd;

@ -642,23 +642,17 @@ void lc::MainWindow::SetupWidgets() {
}
// Fill the 'CBWebcamChooser' with all available network webcams
ui->CBWebcamChooser->addItem( "Choose a webcam to view:", QVariant( 0 ) );
QStringList *webcams = lablib->GetWebcams();
if ( !( webcams == nullptr ) ) {
for ( auto s : *webcams )
ui->CBWebcamChooser->addItem( s, QVariant( 0 ) );
if ( !settings->webcams.isEmpty() ) {
for ( const auto &s : settings->webcams )
ui->CBWebcamChooser->addItem( s );
}
// Deactivate the webcam choosing interface, if no webcams are available (none mounted at clients and none mounted in the laboratory)
if ( ui->CBWebcamChooser->count() == 1 ) {
// Deactivate the webcam choosing interface, if no webcams are available
if ( ui->CBWebcamChooser->count() == 0 ) {
ui->LWebcamChooser->setEnabled( false );
ui->CBWebcamChooser->setEnabled( false );
QMessageBox messageBox{ QMessageBox::Warning, tr( "Could not add webcams" ),
tr( "The initialization of the webcams failed. Please check the configuration file of Labcontrol." ), QMessageBox::Ok, this };
messageBox.exec();
}
clients = nullptr;
webcams = nullptr;
const QStringList *zTreeEntries = lablib->GetInstalledZTreeVersions();
if ( zTreeEntries == nullptr ) {

Loading…
Cancel
Save