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

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

@ -73,7 +73,6 @@ lc::Lablib::~Lablib () {
delete clients; delete clients;
delete InstalledZTreeVersions; delete InstalledZTreeVersions;
delete occupiedPorts; delete occupiedPorts;
delete webcams;
} }
bool lc::Lablib::CheckIfUserIsAdmin() const { bool lc::Lablib::CheckIfUserIsAdmin() const {
@ -197,10 +196,6 @@ void lc::Lablib::ReadSettings() {
messageBox.exec(); messageBox.exec();
debugMessagesTextEdit->appendPlainText( tr( "[DEBUG] 'webcams' was not set. No stationary webcams will be available." ) ); 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 // Get the client quantity to check the value lists for clients creation for correct length
int clientQuantity = 0; int clientQuantity = 0;

@ -117,11 +117,6 @@ public:
* @return A pointer to a QStringList containing all available zTree versions * @return A pointer to a QStringList containing all available zTree versions
*/ */
QStringList *GetInstalledZTreeVersions () const { return InstalledZTreeVersions; } 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 SetChosenZTreeDataTargetPath( const QString &argZTreeDataTargetPath );
void SetChosenZTreePort( const int &argPort ); void SetChosenZTreePort( const int &argPort );
//! Sets the default name of local zLeaf instances //! Sets the default name of local zLeaf instances
@ -170,7 +165,6 @@ private:
QVector< int > *occupiedPorts = nullptr; QVector< int > *occupiedPorts = nullptr;
bool PrintReceiptsForLocalClients = true; bool PrintReceiptsForLocalClients = true;
SessionsModel *sessionsModel = nullptr; //! A derivation from QAbstractTableModel used to store the single Session instances 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", wakeonlanCmd{ ReadSettingsItem( "wakeonlan_command",
"Booting the clients will not work.", "Booting the clients will not work.",
argSettings, true ) }, argSettings, true ) },
webcams{ argSettings.value( "webcams", "" ).toString().split( '|', QString::SkipEmptyParts,
Qt::CaseInsensitive ) },
wineCmd{ ReadSettingsItem( "wine_command", wineCmd{ ReadSettingsItem( "wine_command",
"Running z-Leaves or z-Tree will be possible.", "Running z-Leaves or z-Tree will be possible.",
argSettings, true ) }, argSettings, true ) },
@ -92,6 +94,7 @@ lc::Settings::Settings( const QSettings &argSettings, QObject *argParent ) :
"The local zLeaf default name will default to 'local'.", "The local zLeaf default name will default to 'local'.",
argSettings, false ) } argSettings, false ) }
{ {
qDebug() << "The following webcams where loaded:" << webcams;
} }
bool lc::Settings::CheckPathAndComplain( const QString &argPath, const QString &argVariableName, bool lc::Settings::CheckPathAndComplain( const QString &argPath, const QString &argVariableName,

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

@ -642,23 +642,17 @@ void lc::MainWindow::SetupWidgets() {
} }
// Fill the 'CBWebcamChooser' with all available network webcams // Fill the 'CBWebcamChooser' with all available network webcams
ui->CBWebcamChooser->addItem( "Choose a webcam to view:", QVariant( 0 ) ); if ( !settings->webcams.isEmpty() ) {
QStringList *webcams = lablib->GetWebcams(); for ( const auto &s : settings->webcams )
if ( !( webcams == nullptr ) ) { ui->CBWebcamChooser->addItem( s );
for ( auto s : *webcams )
ui->CBWebcamChooser->addItem( s, QVariant( 0 ) );
} }
// Deactivate the webcam choosing interface, if no webcams are available (none mounted at clients and none mounted in the laboratory) // Deactivate the webcam choosing interface, if no webcams are available
if ( ui->CBWebcamChooser->count() == 1 ) { if ( ui->CBWebcamChooser->count() == 0 ) {
ui->LWebcamChooser->setEnabled( false ); ui->LWebcamChooser->setEnabled( false );
ui->CBWebcamChooser->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; clients = nullptr;
webcams = nullptr;
const QStringList *zTreeEntries = lablib->GetInstalledZTreeVersions(); const QStringList *zTreeEntries = lablib->GetInstalledZTreeVersions();
if ( zTreeEntries == nullptr ) { if ( zTreeEntries == nullptr ) {

Loading…
Cancel
Save