Began getting rid of global "settings" variable

remotes/origin/HEAD
markuspg 7 years ago
parent 826e34f941
commit 9704e65a06

@ -28,11 +28,11 @@
#include <memory> #include <memory>
extern std::unique_ptr<lc::Settings> settings; lc::ClientHelpNotificationServer::ClientHelpNotificationServer(const Settings *const argSettings,
QObject *argParent) :
lc::ClientHelpNotificationServer::ClientHelpNotificationServer(QObject *argParent) :
QObject{argParent}, QObject{argParent},
hostAddress{settings->serverIP} hostAddress{settings->serverIP},
settings{argSettings}
{ {
QNetworkConfigurationManager manager; QNetworkConfigurationManager manager;
if (manager.capabilities() if (manager.capabilities()

@ -27,17 +27,21 @@ class QTcpServer;
namespace lc { namespace lc {
class Settings;
class ClientHelpNotificationServer : public QObject class ClientHelpNotificationServer : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ClientHelpNotificationServer(QObject *argParent = nullptr); explicit ClientHelpNotificationServer(const Settings *const argSettings,
QObject *argParent = nullptr);
private: private:
QTcpServer *helpMessageServer = nullptr; QTcpServer *helpMessageServer = nullptr;
const QHostAddress hostAddress; const QHostAddress hostAddress;
QNetworkSession *networkSession = nullptr; QNetworkSession *networkSession = nullptr;
const Settings *const settings = nullptr;
private slots: private slots:
void OpenSession(); void OpenSession();

@ -24,10 +24,11 @@
#include "lablib.h" #include "lablib.h"
lc::Lablib::Lablib(QObject *argParent) : lc::Lablib::Lablib(Settings *const argSettings, QObject *argParent) :
QObject{argParent}, QObject{argParent},
labSettings{"Labcontrol", "Labcontrol", this}, labSettings{"Labcontrol", "Labcontrol", this},
sessionsModel{new SessionsModel{this}} sessionsModel{new SessionsModel{this}},
settings{argSettings}
{ {
for (const auto &s : settings->GetClients()) { for (const auto &s : settings->GetClients()) {
connect(this, &Lablib::ZLEAF_RUNNING, connect(this, &Lablib::ZLEAF_RUNNING,
@ -52,7 +53,8 @@ lc::Lablib::Lablib(QObject *argParent) :
// Initialize the server for client help requests retrieval // Initialize the server for client help requests retrieval
if (settings->clientHelpNotificationServerPort if (settings->clientHelpNotificationServerPort
&& !settings->serverIP.isEmpty()) { && !settings->serverIP.isEmpty()) {
clientHelpNotificationServer = new ClientHelpNotificationServer{this}; clientHelpNotificationServer
= new ClientHelpNotificationServer{settings, this};
} }
} }
@ -157,7 +159,8 @@ void lc::Lablib::StartNewSession(QVector<Client *> argAssocCl,
argzTreePort, argzTreeVersion, argzTreePort, argzTreeVersion,
argPrintLocalReceipts, argPrintLocalReceipts,
argParticipNameReplacement, argParticipNameReplacement,
argReceiptsHeader}); argReceiptsHeader,
settings});
occupiedPorts.append(sessionsModel->back()->zTreePort); occupiedPorts.append(sessionsModel->back()->zTreePort);
} catch (Session::lcDataTargetPathCreationFailed) { } catch (Session::lcDataTargetPathCreationFailed) {
QMessageBox::information(nullptr, tr("Chosen data target path could not be created"), QMessageBox::information(nullptr, tr("Chosen data target path could not be created"),

@ -45,8 +45,6 @@
#include "sessionsmodel.h" #include "sessionsmodel.h"
#include "settings.h" #include "settings.h"
extern std::unique_ptr<lc::Settings> settings;
namespace lc { namespace lc {
//! This class represents the entire lab and running sessions. //! This class represents the entire lab and running sessions.
@ -62,7 +60,7 @@ public:
* \brief Lablib's constructor * \brief Lablib's constructor
* \param[in] argParent This 'lcLablib' instance's parent QObject * \param[in] argParent This 'lcLablib' instance's parent QObject
*/ */
Lablib(QObject *argParent = nullptr); Lablib(Settings *const argSettings, QObject *argParent = nullptr);
/** Lablib's destructor /** Lablib's destructor
*/ */
~Lablib() override; ~Lablib() override;
@ -135,6 +133,7 @@ private:
QVector< quint16 > occupiedPorts; QVector< quint16 > occupiedPorts;
//! A derivation from QAbstractTableModel used to store the single Session instances //! A derivation from QAbstractTableModel used to store the single Session instances
SessionsModel *sessionsModel = nullptr; SessionsModel *sessionsModel = nullptr;
Settings *const settings = nullptr;
}; };
} // namespace lc } // namespace lc

@ -24,9 +24,8 @@
#include "receipts_handler.h" #include "receipts_handler.h"
#include "settings.h" #include "settings.h"
extern std::unique_ptr<lc::Settings> settings; lc::ReceiptsHandler::ReceiptsHandler(const Settings *const argSettings,
const QString &argZTreeDataTargetPath,
lc::ReceiptsHandler::ReceiptsHandler(const QString &argZTreeDataTargetPath,
bool argPrintReceiptsForLocalClients, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, const QString &argLatexHeaderName,
@ -39,6 +38,7 @@ lc::ReceiptsHandler::ReceiptsHandler(const QString &argZTreeDataTargetPath,
latexHeaderName{argLatexHeaderName}, latexHeaderName{argLatexHeaderName},
paymentFile{expectedPaymentFilePath}, paymentFile{expectedPaymentFilePath},
printReceiptsForLocalClients{argPrintReceiptsForLocalClients}, printReceiptsForLocalClients{argPrintReceiptsForLocalClients},
settings{argSettings},
timer{new QTimer{this}}, timer{new QTimer{this}},
zTreeDataTargetPath{argZTreeDataTargetPath} zTreeDataTargetPath{argZTreeDataTargetPath}
{ {
@ -50,7 +50,8 @@ zTreeDataTargetPath{argZTreeDataTargetPath}
timer->start(2000); timer->start(2000);
} }
lc::ReceiptsHandler::ReceiptsHandler(const QString &argZTreeDataTargetPath, lc::ReceiptsHandler::ReceiptsHandler(const Settings *const argSettings,
const QString &argZTreeDataTargetPath,
bool argPrintReceiptsForLocalClients, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, const QString &argLatexHeaderName,
@ -63,6 +64,7 @@ lc::ReceiptsHandler::ReceiptsHandler(const QString &argZTreeDataTargetPath,
latexHeaderName{argLatexHeaderName}, latexHeaderName{argLatexHeaderName},
paymentFile{expectedPaymentFilePath}, paymentFile{expectedPaymentFilePath},
printReceiptsForLocalClients{argPrintReceiptsForLocalClients}, printReceiptsForLocalClients{argPrintReceiptsForLocalClients},
settings{argSettings},
zTreeDataTargetPath{argZTreeDataTargetPath} zTreeDataTargetPath{argZTreeDataTargetPath}
{ {
qDebug() << "Expected payment file name is:" << expectedPaymentFilePath; qDebug() << "Expected payment file name is:" << expectedPaymentFilePath;
@ -198,13 +200,14 @@ void lc::ReceiptsHandler::CreateReceiptsFromPaymentFile()
} }
// Open a QTextStream to write to the file // Open a QTextStream to write to the file
QTextStream out(texFile); QTextStream out{texFile};
out << *latexText; out << *latexText;
delete latexText; delete latexText;
latexText = nullptr; latexText = nullptr;
receiptsPrinter = new ReceiptsPrinter{dateString, zTreeDataTargetPath, this}; receiptsPrinter = new ReceiptsPrinter{dateString, settings,
zTreeDataTargetPath, this};
receiptsPrinter->start(); receiptsPrinter->start();
connect(receiptsPrinter, &ReceiptsPrinter::PrintingFinished, connect(receiptsPrinter, &ReceiptsPrinter::PrintingFinished,
this, &ReceiptsHandler::DeleteReceiptsPrinterInstance); this, &ReceiptsHandler::DeleteReceiptsPrinterInstance);

@ -42,6 +42,8 @@ struct paymentEntry_t {
double payoff; double payoff;
}; };
class Settings;
//! A class to handle receipts printing. //! A class to handle receipts printing.
/*! /*!
This class is element of every session and is used to handle the receipts printing. This class is element of every session and is used to handle the receipts printing.
@ -51,11 +53,13 @@ class ReceiptsHandler : public QObject
Q_OBJECT Q_OBJECT
public: public:
explicit ReceiptsHandler(const QString &argZTreeDataTargetPath, explicit ReceiptsHandler(const Settings *const argSettings,
const QString &argZTreeDataTargetPath,
bool argPrintReceiptsForLocalClients, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, QObject *argParent = nullptr); const QString &argLatexHeaderName, QObject *argParent = nullptr);
explicit ReceiptsHandler(const QString &argZTreeDataTargetPath, explicit ReceiptsHandler(const Settings *const argSettings,
const QString &argZTreeDataTargetPath,
bool argPrintReceiptsForLocalClients, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, const QString &argLatexHeaderName,
@ -98,6 +102,7 @@ private:
const bool printReceiptsForLocalClients; const bool printReceiptsForLocalClients;
//! Creates new thread for receipts printing //! Creates new thread for receipts printing
ReceiptsPrinter *receiptsPrinter = nullptr; ReceiptsPrinter *receiptsPrinter = nullptr;
const Settings *const settings = nullptr;
//! Used for regular checking if the payment file was created //! Used for regular checking if the payment file was created
QTimer *timer = nullptr; QTimer *timer = nullptr;
//! A reference to the data target path stored in the session class instance //! A reference to the data target path stored in the session class instance

@ -17,25 +17,22 @@
* along with Labcontrol. If not, see <http://www.gnu.org/licenses/>. * along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <memory>
#include "receiptsprinter.h" #include "receiptsprinter.h"
#include "settings.h" #include "settings.h"
extern std::unique_ptr<lc::Settings> settings;
lc::ReceiptsPrinter::ReceiptsPrinter(const QString &argDateString, lc::ReceiptsPrinter::ReceiptsPrinter(const QString &argDateString,
const Settings *const argSettings,
const QString &argWorkpath, const QString &argWorkpath,
QObject *argParent) : QObject *argParent) :
QThread{argParent}, QThread{argParent},
dateString{argDateString}, dateString{argDateString},
dvipsCmd{settings->dvipsCmd}, dvipsCmd{argSettings->dvipsCmd},
latexCmd{settings->latexCmd}, latexCmd{argSettings->latexCmd},
lprCmd{settings->lprCmd}, lprCmd{argSettings->lprCmd},
postscriptViewer{ settings->postscriptViewer}, postscriptViewer{argSettings->postscriptViewer},
ps2pdfCmd{settings->ps2pdfCmd}, ps2pdfCmd{argSettings->ps2pdfCmd},
rmCmd{settings->rmCmd}, rmCmd{argSettings->rmCmd},
vncViewer{settings->vncViewer}, vncViewer{argSettings->vncViewer},
workpath{argWorkpath} workpath{argWorkpath}
{ {
} }

@ -28,6 +28,8 @@
namespace lc { namespace lc {
class Settings;
//! A class for receipts creation. //! A class for receipts creation.
/*! /*!
This class is used to do the actual printing of the receipts in an own thread. This class is used to do the actual printing of the receipts in an own thread.
@ -151,6 +153,7 @@ class ReceiptsPrinter : public QThread
} }
public: public:
explicit ReceiptsPrinter(const QString &argDateString, explicit ReceiptsPrinter(const QString &argDateString,
const Settings *const argSettings,
const QString &argWorkpath, const QString &argWorkpath,
QObject *argParent = nullptr); QObject *argParent = nullptr);

@ -24,19 +24,19 @@
#include <memory> #include <memory>
extern std::unique_ptr<lc::Settings> settings;
lc::Session::Session(QVector<Client *> &&argAssocClients, lc::Session::Session(QVector<Client *> &&argAssocClients,
const QString &argZTreeDataTargetPath, const quint16 argZTreePort, const QString &argZTreeDataTargetPath, const quint16 argZTreePort,
const QString &argZTreeVersionPath, bool argPrintReceiptsForLocalClients, const QString &argZTreeVersionPath, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, QObject *argParent): const QString &argLatexHeaderName,
const Settings *const argSettings, QObject *argParent):
QObject{argParent}, QObject{argParent},
zTreePort{argZTreePort}, zTreePort{argZTreePort},
anonymousReceiptsPlaceholder{argAnonymousReceiptsPlaceholder}, anonymousReceiptsPlaceholder{argAnonymousReceiptsPlaceholder},
assocClients{std::move(argAssocClients)}, assocClients{std::move(argAssocClients)},
latexHeaderName{argLatexHeaderName}, latexHeaderName{argLatexHeaderName},
printReceiptsForLocalClients{argPrintReceiptsForLocalClients}, printReceiptsForLocalClients{argPrintReceiptsForLocalClients},
settings{argSettings},
zTreeDataTargetPath{argZTreeDataTargetPath}, zTreeDataTargetPath{argZTreeDataTargetPath},
zTreeVersionPath{argZTreeVersionPath} zTreeVersionPath{argZTreeVersionPath}
{ {
@ -88,14 +88,15 @@ void lc::Session::InitializeClasses()
zTreeDataTargetPath.append("/" + date_string + "-" + QString::number(zTreePort)); zTreeDataTargetPath.append("/" + date_string + "-" + QString::number(zTreePort));
qDebug() << "New session's chosen_zTree_data_target_path:" << zTreeDataTargetPath; qDebug() << "New session's chosen_zTree_data_target_path:" << zTreeDataTargetPath;
zTreeInstance = new ZTree{zTreeDataTargetPath, zTreePort, zTreeInstance = new ZTree{settings, zTreeDataTargetPath, zTreePort,
zTreeVersionPath, this}; zTreeVersionPath, this};
connect(zTreeInstance, &ZTree::ZTreeClosed, connect(zTreeInstance, &ZTree::ZTreeClosed,
this, &Session::OnzTreeClosed); this, &Session::OnzTreeClosed);
// Only create a 'Receipts_Handler' instance, if all neccessary variables were set // Only create a 'Receipts_Handler' instance, if all neccessary variables were set
if (latexHeaderName != "None found" && !settings->dvipsCmd.isEmpty() if (latexHeaderName != "None found" && !settings->dvipsCmd.isEmpty()
&& !settings->latexCmd.isEmpty()) { && !settings->latexCmd.isEmpty()) {
new ReceiptsHandler{zTreeDataTargetPath, printReceiptsForLocalClients, new ReceiptsHandler{settings, zTreeDataTargetPath,
printReceiptsForLocalClients,
anonymousReceiptsPlaceholder, latexHeaderName, this}; anonymousReceiptsPlaceholder, latexHeaderName, this};
} else { } else {
qDebug() << "No 'ReceiptsHandler' instance was created."; qDebug() << "No 'ReceiptsHandler' instance was created.";

@ -29,6 +29,7 @@
namespace lc { namespace lc {
class Client; class Client;
class Settings;
//! A class containing an entire session. //! A class containing an entire session.
/*! /*!
@ -46,7 +47,8 @@ public:
const quint16 argZTreePort, const QString &argZTreeVersionPath, const quint16 argZTreePort, const QString &argZTreeVersionPath,
bool argPrintReceiptsForLocalClients, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, QObject *argParent = nullptr); const QString &argLatexHeaderName,
const Settings *const argSettings, QObject *argParent = nullptr);
~Session() override; ~Session() override;
/*! Returns the data item with the given index /*! Returns the data item with the given index
@ -78,6 +80,7 @@ private:
const QString latexHeaderName; const QString latexHeaderName;
//! True if receipts shall be printed for local clients //! True if receipts shall be printed for local clients
const bool printReceiptsForLocalClients = true; const bool printReceiptsForLocalClients = true;
const Settings *const settings;
//! The path were the data of this zTree instance's session will be saved //! The path were the data of this zTree instance's session will be saved
QString zTreeDataTargetPath; QString zTreeDataTargetPath;
//! The session's zTree instance //! The session's zTree instance

@ -45,7 +45,7 @@ public:
{ {
return chosenzTreePort; return chosenzTreePort;
} }
QVector< Client * > &GetClients() const QVector<Client *> &GetClients() const
{ {
return clients; return clients;
} }

@ -25,11 +25,11 @@
#include <memory> #include <memory>
extern std::unique_ptr<lc::Settings> settings; lc::ZTree::ZTree(const Settings *const argSettings,
const QString &argZTreeDataTargetPath, const int argZTreePort,
lc::ZTree::ZTree(const QString &argZTreeDataTargetPath, const int argZTreePort,
const QString &argZTreeVersionPath, QObject *argParent) : const QString &argZTreeVersionPath, QObject *argParent) :
QObject{argParent} QObject{argParent},
settings{argSettings}
{ {
QStringList arguments{QStringList{} << "-c" << "0" << settings->wineCmd QStringList arguments{QStringList{} << "-c" << "0" << settings->wineCmd
<< QString{settings->zTreeInstDir + "/zTree_" << QString{settings->zTreeInstDir + "/zTree_"

@ -26,6 +26,8 @@
namespace lc { namespace lc {
class Settings;
//! A class to contain running zTree instances. //! A class to contain running zTree instances.
/*! /*!
This class is element of every session and is used to handle all zTree related data. This class is element of every session and is used to handle all zTree related data.
@ -35,7 +37,8 @@ class ZTree: public QObject
Q_OBJECT Q_OBJECT
public: public:
ZTree(const QString &argZTreeDataTargetPath, ZTree(const Settings *const argSettings,
const QString &argZTreeDataTargetPath,
const int argZTreePort, const QString &argZTreeVersionPath, const int argZTreePort, const QString &argZTreeVersionPath,
QObject *argParent = nullptr); QObject *argParent = nullptr);
@ -43,6 +46,7 @@ signals:
void ZTreeClosed(int argExitCode); void ZTreeClosed(int argExitCode);
private: private:
const Settings *const settings = nullptr;
QProcess zTreeInstance; QProcess zTreeInstance;
}; };

@ -25,10 +25,10 @@
#include <memory> #include <memory>
extern std::unique_ptr<lc::Settings> settings; lc::LocalzLeafStarter::LocalzLeafStarter(Settings *const argSettings,
QWidget *argParent) :
lc::LocalzLeafStarter::LocalzLeafStarter(QWidget *argParent) :
QWidget{argParent}, QWidget{argParent},
settings{argSettings},
ui{new Ui::LocalzLeafStarter} ui{new Ui::LocalzLeafStarter}
{ {
ui->setupUi(this); ui->setupUi(this);

@ -28,12 +28,15 @@ namespace Ui {
class LocalzLeafStarter; class LocalzLeafStarter;
} // namespace Ui } // namespace Ui
class Settings;
class LocalzLeafStarter : public QWidget class LocalzLeafStarter : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit LocalzLeafStarter(QWidget *argParent = nullptr); explicit LocalzLeafStarter(Settings *const argSettings,
QWidget *argParent = nullptr);
~LocalzLeafStarter() override; ~LocalzLeafStarter() override;
signals: signals:
@ -41,6 +44,7 @@ signals:
int argzTreePort); int argzTreePort);
private: private:
Settings *const settings = nullptr;
Ui::LocalzLeafStarter *const ui = nullptr; Ui::LocalzLeafStarter *const ui = nullptr;
private slots: private slots:

@ -31,7 +31,7 @@ int main(int argc, char *argv[])
QApplication a{argc, argv}; QApplication a{argc, argv};
settings = std::make_unique<lc::Settings>(QSettings{"Labcontrol", settings = std::make_unique<lc::Settings>(QSettings{"Labcontrol",
"Labcontrol"}); "Labcontrol"});
lc::MainWindow w; lc::MainWindow w{settings.get()};
w.show(); w.show();
return a.exec(); return a.exec();

@ -1,5 +1,5 @@
/* /*
* Copyright 2014-2016 Markus Prasser * Copyright 2014-2018 Markus Prasser, Tobias Weiss
* *
* This file is part of Labcontrol. * This file is part of Labcontrol.
* *
@ -17,8 +17,6 @@
* along with Labcontrol. If not, see <http://www.gnu.org/licenses/>. * along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <memory>
#include <QtGlobal> #include <QtGlobal>
#include <QDebug> #include <QDebug>
#include <QInputDialog> #include <QInputDialog>
@ -28,70 +26,73 @@
#include "manualprintingsetup.h" #include "manualprintingsetup.h"
#include "Lib/settings.h" #include "Lib/settings.h"
extern std::unique_ptr< lc::Settings > settings; lc::MainWindow::MainWindow(Settings *const argSettings,
QWidget *argParent) :
lc::MainWindow::MainWindow( QWidget *argParent ) : QMainWindow{argParent},
QMainWindow{ argParent }, icons(static_cast<int>(icons_t::ICON_QUANTITY)),
icons( static_cast< int >( icons_t::ICON_QUANTITY ) ), settings{argSettings},
ui{ new Ui::MainWindow } ui{new Ui::MainWindow}
{ {
ui->setupUi( this ); ui->setupUi(this);
lablib = new Lablib{ this }; lablib = new Lablib{settings, this};
LoadIconPixmaps(); LoadIconPixmaps();
SetupWidgets(); SetupWidgets();
if ( valid_items ) { if (valid_items) {
gui_update_timer = new QTimer{ this }; gui_update_timer = new QTimer{this};
connect( gui_update_timer, &QTimer::timeout, connect( gui_update_timer, &QTimer::timeout,
this, &MainWindow::UpdateClientsTableView ); this, &MainWindow::UpdateClientsTableView );
gui_update_timer->start( 500 ); gui_update_timer->start(500);
} }
/* session actions */ /* session actions */
// Add z-Tree versions to the corresponding combo box // Add z-Tree versions to the corresponding combo box
ui->CBzTreeVersion->addItem( tr( "Please choose a version:" ) ); ui->CBzTreeVersion->addItem(tr("Please choose a version:"));
ui->CBzTreeVersion->addItems( settings->installedZTreeVersions ); ui->CBzTreeVersion->addItems(settings->installedZTreeVersions);
// Add default path to the corresponding combo box // Add default path to the corresponding combo box
ui->CBDataTargetPath->addItem( tr( "Set a new path HERE" ) ); ui->CBDataTargetPath->addItem(tr("Set a new path HERE"));
ui->CBDataTargetPath->addItem( QDir::homePath() ); ui->CBDataTargetPath->addItem(QDir::homePath());
ui->CBDataTargetPath->addItem( QDir::homePath() + "/zTreeData" ); ui->CBDataTargetPath->addItem(QDir::homePath() + "/zTreeData");
ui->CBDataTargetPath->setCurrentIndex( 2 ); ui->CBDataTargetPath->setCurrentIndex(2);
connect( this, &MainWindow::RequestNewDataTargetPath, connect(this, &MainWindow::RequestNewDataTargetPath,
this, &MainWindow::GetNewDataTargetPath ); this, &MainWindow::GetNewDataTargetPath);
if ( settings->dvipsCmd.isEmpty() || settings->latexCmd.isEmpty() if (settings->dvipsCmd.isEmpty() || settings->latexCmd.isEmpty()
|| settings->lcDataDir.isEmpty() || settings->lprCmd.isEmpty() || settings->lcDataDir.isEmpty() || settings->lprCmd.isEmpty()
|| settings->postscriptViewer.isEmpty() || settings->ps2pdfCmd.isEmpty() || settings->postscriptViewer.isEmpty() || settings->ps2pdfCmd.isEmpty()
|| settings->rmCmd.isEmpty() || settings->vncViewer.isEmpty() ) { || settings->rmCmd.isEmpty() || settings->vncViewer.isEmpty()) {
QMessageBox::information( this, tr( "Receipts printing will not work" ), QMessageBox::information(this, tr("Receipts printing will not work"),
tr( "Some component essential for receipts creation and" tr("Some component essential for receipts creation and"
" printing is missing. No receipts will be created or" " printing is missing. No receipts will be created or"
" printed." ), QMessageBox::Ok ); " printed."), QMessageBox::Ok);
} else { } else {
ui->CBReceiptsHeader->addItems( settings->installedLaTeXHeaders ); ui->CBReceiptsHeader->addItems(settings->installedLaTeXHeaders);
if ( settings->defaultReceiptIndex if (settings->defaultReceiptIndex
&& settings->defaultReceiptIndex < ui->CBReceiptsHeader->count() ) { && settings->defaultReceiptIndex < ui->CBReceiptsHeader->count()) {
ui->CBReceiptsHeader->setCurrentIndex( settings->defaultReceiptIndex ); ui->CBReceiptsHeader->setCurrentIndex(settings->defaultReceiptIndex);
} }
} }
} }
lc::MainWindow::~MainWindow() { lc::MainWindow::~MainWindow()
{
delete ui; delete ui;
delete valid_items; delete valid_items;
} }
bool lc::MainWindow::CheckIfUserIsAdmin() { bool lc::MainWindow::CheckIfUserIsAdmin()
if ( settings->localUserName.isEmpty() ) { {
QMessageBox messageBox{ QMessageBox::Warning, tr( "User not detectable" ), if (settings->localUserName.isEmpty()) {
tr( "Your user name could not be queryed. The admin tab will be" QMessageBox messageBox{QMessageBox::Warning, tr("User not detectable"),
" disabled. You won't be able to perform administrative" tr("Your user name could not be queryed. The"
" actions but can conduct experiments normally." ), " admin tab will be disabled. You won't be"
QMessageBox::Ok }; " able to perform administrative actions"
" but can conduct experiments normally."),
QMessageBox::Ok};
messageBox.exec(); messageBox.exec();
return false; return false;
} }
@ -101,7 +102,8 @@ bool lc::MainWindow::CheckIfUserIsAdmin() {
return lablib->CheckIfUserIsAdmin(); return lablib->CheckIfUserIsAdmin();
} }
void lc::MainWindow::DisableDisfunctionalWidgets() { void lc::MainWindow::DisableDisfunctionalWidgets()
{
const QStringList &zTreeEntries = settings->installedZTreeVersions; const QStringList &zTreeEntries = settings->installedZTreeVersions;
if ( zTreeEntries.isEmpty() ) { if ( zTreeEntries.isEmpty() ) {
ui->CBClientNames->setEnabled( false ); ui->CBClientNames->setEnabled( false );
@ -145,13 +147,13 @@ void lc::MainWindow::DisableDisfunctionalWidgets() {
// Disable 'PBShowORSEE', if 'orsee_command' was not set // Disable 'PBShowORSEE', if 'orsee_command' was not set
if ( settings->browserCmd.isEmpty() if ( settings->browserCmd.isEmpty()
|| settings->orseeUrl.isEmpty() ) { || settings->orseeUrl.isEmpty() ) {
ui->PBShowORSEE->setEnabled( false ); ui->PBShowORSEE->setEnabled( false );
} }
// Disable all widgets needless if 'public_key_path_user' or 'user_name_on_clients' was not set // Disable all widgets needless if 'public_key_path_user' or 'user_name_on_clients' was not set
if ( settings->pkeyPathUser.isEmpty() if ( settings->pkeyPathUser.isEmpty()
|| settings->userNameOnClients.isEmpty() ) { || settings->userNameOnClients.isEmpty() ) {
ui->CBClientNames->setEnabled( false ); ui->CBClientNames->setEnabled( false );
ui->LEFilePath->setEnabled( false ); ui->LEFilePath->setEnabled( false );
ui->L_FakeName->setEnabled( false ); ui->L_FakeName->setEnabled( false );
@ -172,7 +174,7 @@ void lc::MainWindow::DisableDisfunctionalWidgets() {
} }
if ( settings->pkeyPathRoot.isEmpty() if ( settings->pkeyPathRoot.isEmpty()
&& settings->pkeyPathUser.isEmpty() ) { && settings->pkeyPathUser.isEmpty() ) {
ui->GBExecuteOnEveryClient->setEnabled( false ); ui->GBExecuteOnEveryClient->setEnabled( false );
ui->GBOptionsForAdminActions->setEnabled( false ); ui->GBOptionsForAdminActions->setEnabled( false );
ui->PBOpenTerminal->setEnabled( false ); ui->PBOpenTerminal->setEnabled( false );
@ -234,7 +236,7 @@ void lc::MainWindow::DisableDisfunctionalWidgets() {
// Deactivate the webcam choosing interface if no webcams are available or the viewer is missing // Deactivate the webcam choosing interface if no webcams are available or the viewer is missing
if ( settings->webcamDisplayCmd.isEmpty() if ( settings->webcamDisplayCmd.isEmpty()
|| settings->webcams.isEmpty() ) { || settings->webcams.isEmpty() ) {
ui->CBWebcamChooser->setEnabled( false ); ui->CBWebcamChooser->setEnabled( false );
ui->L_WebcamChooser->setEnabled( false ); ui->L_WebcamChooser->setEnabled( false );
} }
@ -258,18 +260,19 @@ void lc::MainWindow::DisableDisfunctionalWidgets() {
} }
} }
void lc::MainWindow::LoadIconPixmaps() { void lc::MainWindow::LoadIconPixmaps()
{
if ( settings->lcDataDir.isEmpty() ) { if ( settings->lcDataDir.isEmpty() ) {
return; return;
} }
const QStringList iconNames{ QStringList{} const QStringList iconNames{ QStringList{}
<< "unknown.png" << "unknown.png"
<< "off.png" << "off.png"
<< "down.png" << "down.png"
<< "boot.png" << "boot.png"
<< "on.png" << "on.png"
<< "zLeaf.png" }; << "zLeaf.png" };
for ( int i = 0; i < ( int )icons_t::ICON_QUANTITY; i++ ) { for ( int i = 0; i < ( int )icons_t::ICON_QUANTITY; i++ ) {
if ( !icons[ i ].load( settings->lcDataDir + "/icons/" + iconNames[ i ] ) ) { if ( !icons[ i ].load( settings->lcDataDir + "/icons/" + iconNames[ i ] ) ) {
@ -280,7 +283,8 @@ void lc::MainWindow::LoadIconPixmaps() {
} }
} }
void lc::MainWindow::on_PBKillLocalzLeaf_clicked() { void lc::MainWindow::on_PBKillLocalzLeaf_clicked()
{
QString program{ settings->killallCmd }; QString program{ settings->killallCmd };
QStringList arguments; QStringList arguments;
arguments << "-I" << "-q" << "zleaf.exe"; arguments << "-I" << "-q" << "zleaf.exe";
@ -297,21 +301,24 @@ void lc::MainWindow::on_PBKillLocalzLeaf_clicked() {
qDebug() << program << arguments; qDebug() << program << arguments;
} }
void lc::MainWindow::on_PBPrintPaymentFileManually_clicked() { void lc::MainWindow::on_PBPrintPaymentFileManually_clicked()
ManualPrintingSetup *manPrint = new ManualPrintingSetup{ this }; {
manPrint->setWindowFlags( Qt::Window ); ManualPrintingSetup *manPrint = new ManualPrintingSetup{settings, this};
manPrint->setWindowFlags(Qt::Window);
manPrint->show(); manPrint->show();
connect( manPrint, SIGNAL( destroyed( QObject* ) ), connect(manPrint, SIGNAL(destroyed(QObject *)),
manPrint, SLOT( deleteLater() ) ); manPrint, SLOT(deleteLater()));
connect( manPrint, &ManualPrintingSetup::RequestReceiptsHandler, connect(manPrint, &ManualPrintingSetup::RequestReceiptsHandler,
this, &MainWindow::StartReceiptsHandler ); this, &MainWindow::StartReceiptsHandler);
} }
void lc::MainWindow::on_PBRunzLeaf_clicked() { void lc::MainWindow::on_PBRunzLeaf_clicked()
{
// Check if more than one client is selected and issue a warning message if so // Check if more than one client is selected and issue a warning message if so
unsigned short int numberOfSelectedClients = 0; unsigned short int numberOfSelectedClients = 0;
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
++numberOfSelectedClients; ++numberOfSelectedClients;
} }
@ -321,10 +328,11 @@ void lc::MainWindow::on_PBRunzLeaf_clicked() {
QMessageBox messageBox{ QMessageBox::Information, tr( "Too many clients selected" ), tr( "There are too many clients selected in the table view on the left. Please select only one." ), QMessageBox::Ok, this }; QMessageBox messageBox{ QMessageBox::Information, tr( "Too many clients selected" ), tr( "There are too many clients selected in the table view on the left. Please select only one." ), QMessageBox::Ok, this };
messageBox.exec(); messageBox.exec();
} else { } else {
const QString * const fakeName = new QString{ ui->CBClientNames->currentText() }; const QString *const fakeName = new QString{ ui->CBClientNames->currentText() };
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->StartZLeaf( fakeName ); client->StartZLeaf( fakeName );
} }
} }
@ -332,13 +340,15 @@ void lc::MainWindow::on_PBRunzLeaf_clicked() {
} }
} }
void lc::MainWindow::on_RBUseLocalUser_toggled(bool checked) { void lc::MainWindow::on_RBUseLocalUser_toggled(bool checked)
{
if ( checked ) { if ( checked ) {
qDebug() << "'RBUseLocalUser' got toggled."; qDebug() << "'RBUseLocalUser' got toggled.";
} }
} }
void lc::MainWindow::SetupWidgets() { void lc::MainWindow::SetupWidgets()
{
// Fill the 'CBClientNames' with possible client names and the 'TVClients' with the clients // Fill the 'CBClientNames' with possible client names and the 'TVClients' with the clients
if ( !settings->GetClients().isEmpty() ) { if ( !settings->GetClients().isEmpty() ) {
valid_items = new QVector< QStandardItem * >; valid_items = new QVector< QStandardItem * >;
@ -370,7 +380,7 @@ void lc::MainWindow::SetupWidgets() {
valid_items->squeeze(); valid_items->squeeze();
} else { } else {
QMessageBox messageBox{ QMessageBox::Warning, tr( "Could not construct clients view" ), QMessageBox messageBox{ QMessageBox::Warning, tr( "Could not construct clients view" ),
tr( "The creation of the clients view failed. Please check the file '/etc/xdg/Labcontrol/Labcontrol.conf'." ), QMessageBox::Ok, this }; tr( "The creation of the clients view failed. Please check the file '/etc/xdg/Labcontrol/Labcontrol.conf'." ), QMessageBox::Ok, this };
messageBox.exec(); messageBox.exec();
ui->CBClientNames->setEnabled( false ); ui->CBClientNames->setEnabled( false );
ui->GBClientActions->setEnabled( false ); ui->GBClientActions->setEnabled( false );
@ -443,21 +453,26 @@ void lc::MainWindow::SetupWidgets() {
"along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.\n\n\n" ); "along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.\n\n\n" );
} }
void lc::MainWindow::StartReceiptsHandler( QString argzTreeDataTargetPath, void lc::MainWindow::StartReceiptsHandler(QString argzTreeDataTargetPath,
bool argReceiptsForLocalClients, bool argReceiptsForLocalClients,
QString argAnonymousReceiptsPlaceholder, QString argAnonymousReceiptsPlaceholder,
QString argLatexHeaderName, QString argDateString) { QString argLatexHeaderName,
ReceiptsHandler *recHand = new ReceiptsHandler{ argzTreeDataTargetPath, QString argDateString)
argReceiptsForLocalClients, {
argAnonymousReceiptsPlaceholder, const auto recHand = new ReceiptsHandler{settings, argzTreeDataTargetPath,
argLatexHeaderName, argDateString, this }; argReceiptsForLocalClients,
connect( recHand, &ReceiptsHandler::PrintingFinished, argAnonymousReceiptsPlaceholder,
recHand, &ReceiptsHandler::deleteLater ); argLatexHeaderName,
argDateString, this};
connect(recHand, &ReceiptsHandler::PrintingFinished,
recHand, &ReceiptsHandler::deleteLater);
} }
void lc::MainWindow::UpdateClientsTableView() { void lc::MainWindow::UpdateClientsTableView()
{
for ( auto s : *valid_items ) { for ( auto s : *valid_items ) {
state_t state = static_cast< Client* >( s->data( Qt::UserRole ).value<void *>() )->GetClientState(); state_t state = static_cast< Client * >( s->data(
Qt::UserRole ).value<void *>() )->GetClientState();
switch ( state ) { switch ( state ) {
case state_t::RESPONDING: case state_t::RESPONDING:
s->setBackground( QBrush( QColor( 128, 255, 128, 255 ) ) ); s->setBackground( QBrush( QColor( 128, 255, 128, 255 ) ) );
@ -489,89 +504,103 @@ void lc::MainWindow::UpdateClientsTableView() {
/* Experiment tab functions */ /* Experiment tab functions */
void lc::MainWindow::on_PBBoot_clicked() { void lc::MainWindow::on_PBBoot_clicked()
{
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->Boot(); client->Boot();
} }
} }
} }
void lc::MainWindow::on_PBChooseFile_clicked() { void lc::MainWindow::on_PBChooseFile_clicked()
{
QFileDialog *file_dialog = new QFileDialog{ this, tr( "Choose a file to beam" ), QDir::homePath() }; QFileDialog *file_dialog = new QFileDialog{ this, tr( "Choose a file to beam" ), QDir::homePath() };
file_dialog->setFileMode( QFileDialog::Directory ); file_dialog->setFileMode( QFileDialog::Directory );
file_dialog->setOption( QFileDialog::DontUseNativeDialog, true ); file_dialog->setOption( QFileDialog::DontUseNativeDialog, true );
file_dialog->setOption( QFileDialog::ReadOnly, true ); file_dialog->setOption( QFileDialog::ReadOnly, true );
file_dialog->setOption( QFileDialog::ShowDirsOnly, true ); file_dialog->setOption( QFileDialog::ShowDirsOnly, true );
if(file_dialog->exec()) { if (file_dialog->exec()) {
ui->LEFilePath->setText(file_dialog->selectedFiles().at(0)); ui->LEFilePath->setText(file_dialog->selectedFiles().at(0));
qDebug() << "Chose file" << ui->LEFilePath->text() << "for beaming."; qDebug() << "Chose file" << ui->LEFilePath->text() << "for beaming.";
} } else {
else {
ui->LEFilePath->setText( tr( "File choosing cancelled" ) ); ui->LEFilePath->setText( tr( "File choosing cancelled" ) );
qDebug() << "File choosing cancelled"; qDebug() << "File choosing cancelled";
} }
delete file_dialog; delete file_dialog;
} }
void lc::MainWindow::on_PBBeamFile_clicked() { void lc::MainWindow::on_PBBeamFile_clicked()
{
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
const QString fileToBeam{ ui->LEFilePath->text() }; const QString fileToBeam{ ui->LEFilePath->text() };
if(fileToBeam == ""){ if (fileToBeam == "") {
QMessageBox::information(this, "Upload failed", "You didn't choose any folder to upload."); QMessageBox::information(this, "Upload failed", "You didn't choose any folder to upload.");
} else { } else {
//Iterate over the selected clients to upload the file //Iterate over the selected clients to upload the file
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend();
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { ++it ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
client->BeamFile( fileToBeam, &settings->pkeyPathUser, &settings->userNameOnClients ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->BeamFile( fileToBeam, &settings->pkeyPathUser, &settings->userNameOnClients );
}
} }
} // Inform the user about the path
// Inform the user about the path QMessageBox::information(this, "Upload completed",
QMessageBox::information(this, "Upload completed", "The folder was copied to all selected clients.\nThe path on every client is /home/ewfuser/media4ztree" + fileToBeam.mid(fileToBeam.lastIndexOf('/')) +".\nDon't forget to adjust the media path within zTree!"); "The folder was copied to all selected clients.\nThe path on every client is /home/ewfuser/media4ztree"
+ fileToBeam.mid(fileToBeam.lastIndexOf('/')) +
".\nDon't forget to adjust the media path within zTree!");
} }
} }
void lc::MainWindow::on_PBShowORSEE_clicked() { void lc::MainWindow::on_PBShowORSEE_clicked()
{
lablib->ShowOrsee(); lablib->ShowOrsee();
} }
void lc::MainWindow::on_PBShowPreprints_clicked() { void lc::MainWindow::on_PBShowPreprints_clicked()
{
lablib->ShowPreprints(); lablib->ShowPreprints();
} }
void lc::MainWindow::on_PBShutdown_clicked() { void lc::MainWindow::on_PBShutdown_clicked()
{
// Confirmation dialog // Confirmation dialog
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Confirm", "Really shutdown the selected clients?", QMessageBox::Yes|QMessageBox::No); reply = QMessageBox::question(this, "Confirm", "Really shutdown the selected clients?",
QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
// Do not shut down the server itself // Do not shut down the server itself
if ( client->name == "self"){ if ( client->name == "self") {
QMessageBox::information(NULL, "Shutdown canceled", "It is not allowed to shutdown the server itself via labcontrol!"); QMessageBox::information(NULL, "Shutdown canceled",
"It is not allowed to shutdown the server itself via labcontrol!");
} else { } else {
client->Shutdown(); client->Shutdown();
} }
} }
} }
} else { } else {
qDebug() << "Canceled shutting down the selected clients"; qDebug() << "Canceled shutting down the selected clients";
} }
} }
void lc::MainWindow::on_CBWebcamChooser_activated( int argIndex ) { void lc::MainWindow::on_CBWebcamChooser_activated( int argIndex )
{
if ( argIndex != 0 ) { if ( argIndex != 0 ) {
QString program{ settings->webcamDisplayCmd }; QString program{ settings->webcamDisplayCmd };
QStringList arguments; QStringList arguments;
// Attention argIndex is NOT 0-based // Attention argIndex is NOT 0-based
arguments << settings->webcams[argIndex-1]; arguments << settings->webcams[argIndex - 1];
qDebug() << "Webcam" << arguments << "will be opened"; qDebug() << "Webcam" << arguments << "will be opened";
QProcess showWebcamProcess; QProcess showWebcamProcess;
@ -586,9 +615,10 @@ void lc::MainWindow::on_PBstartBrowser_clicked()
QString argURL = ui->LEURL->text(); QString argURL = ui->LEURL->text();
bool argFullscreen = ui->CBFullscreen->checkState(); bool argFullscreen = ui->CBFullscreen->checkState();
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->StartClientBrowser( &argURL, &argFullscreen ); client->StartClientBrowser( &argURL, &argFullscreen );
} }
} }
@ -598,12 +628,14 @@ void lc::MainWindow::on_PBstopBrowser_clicked()
{ {
// Confirmation dialog // Confirmation dialog
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Confirm", "Really kill all selected browser instances?", QMessageBox::Yes|QMessageBox::No); reply = QMessageBox::question(this, "Confirm", "Really kill all selected browser instances?",
QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->StopClientBrowser( ); client->StopClientBrowser( );
} }
} }
@ -616,9 +648,10 @@ void lc::MainWindow::on_PBstopBrowser_clicked()
void lc::MainWindow::on_PBViewDesktopViewOnly_clicked() void lc::MainWindow::on_PBViewDesktopViewOnly_clicked()
{ {
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->ShowDesktopViewOnly(); client->ShowDesktopViewOnly();
} }
} }
@ -628,9 +661,10 @@ void lc::MainWindow::on_PBViewDesktopViewOnly_clicked()
void lc::MainWindow::on_PBViewDesktopFullControl_clicked() void lc::MainWindow::on_PBViewDesktopFullControl_clicked()
{ {
QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activatedItems.cbegin(); it != activatedItems.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->ShowDesktopFullControl(); client->ShowDesktopFullControl();
} }
} }
@ -638,18 +672,21 @@ void lc::MainWindow::on_PBViewDesktopFullControl_clicked()
/* Session tab functions */ /* Session tab functions */
void lc::MainWindow::on_PBStartzLeaf_clicked() { void lc::MainWindow::on_PBStartzLeaf_clicked()
{
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->StartZLeaf( nullptr, ui->LEzLeafCommandline->text() ); client->StartZLeaf( nullptr, ui->LEzLeafCommandline->text() );
} }
} }
} }
void lc::MainWindow::on_PBStartLocalzLeaf_clicked() { void lc::MainWindow::on_PBStartLocalzLeaf_clicked()
LocalzLeafStarter *localzLeafStarter = new LocalzLeafStarter{ this }; {
LocalzLeafStarter *localzLeafStarter = new LocalzLeafStarter{settings, this};
localzLeafStarter->setWindowFlags( Qt::Window ); localzLeafStarter->setWindowFlags( Qt::Window );
localzLeafStarter->show(); localzLeafStarter->show();
connect( localzLeafStarter, &LocalzLeafStarter::LocalzLeafRequested, connect( localzLeafStarter, &LocalzLeafStarter::LocalzLeafRequested,
@ -659,9 +696,10 @@ void lc::MainWindow::on_PBStartLocalzLeaf_clicked() {
} }
void lc::MainWindow::StartLocalzLeaf( QString argzLeafName, QString argzLeafVersion, void lc::MainWindow::StartLocalzLeaf( QString argzLeafName, QString argzLeafVersion,
int argzTreePort ) { int argzTreePort )
{
if ( settings->tasksetCmd.isEmpty() || settings->wineCmd.isEmpty() if ( settings->tasksetCmd.isEmpty() || settings->wineCmd.isEmpty()
|| settings->zTreeInstDir.isEmpty() ) { || settings->zTreeInstDir.isEmpty() ) {
return; return;
} }
@ -673,7 +711,7 @@ void lc::MainWindow::StartLocalzLeaf( QString argzLeafName, QString argzLeafVers
<< "/server" << "127.0.0.1" << "/channel" << "/server" << "127.0.0.1" << "/channel"
<< QString::number( argzTreePort - 7000 ) << "/name" << argzLeafName; << QString::number( argzTreePort - 7000 ) << "/name" << argzLeafName;
if ( !settings->localzLeafSize.isEmpty() ) { if ( !settings->localzLeafSize.isEmpty() ) {
arguments << "/size" << QString{ settings->localzLeafSize }; arguments << "/size" << QString{ settings->localzLeafSize };
} }
qDebug() << "Start local zLeaf:" << arguments; qDebug() << "Start local zLeaf:" << arguments;
@ -687,7 +725,8 @@ void lc::MainWindow::on_PBStopZtree_clicked()
arguments << "-I" << "-q" << "ztree.exe"; arguments << "-I" << "-q" << "ztree.exe";
// Confirmation dialog // Confirmation dialog
QMessageBox::StandardButton reply; QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Confirm", "Really kill all z-Tree instances?", QMessageBox::Yes|QMessageBox::No); reply = QMessageBox::question(this, "Confirm", "Really kill all z-Tree instances?",
QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
// Kill all z-Tree processes // Kill all z-Tree processes
QProcess killLocalzLeafProc; QProcess killLocalzLeafProc;
@ -704,11 +743,11 @@ void lc::MainWindow::on_PBStopZtree_clicked()
void lc::MainWindow::on_PBRecoverCrashedSession_clicked() void lc::MainWindow::on_PBRecoverCrashedSession_clicked()
{ {
// TODO: Implement the functionality of the restore session script in here (no zenity script) // TODO: Implement the functionality of the restore session script in here (no zenity script)
QProcess startProc; QProcess startProc;
startProc.setProcessEnvironment( QProcessEnvironment::systemEnvironment() ); startProc.setProcessEnvironment( QProcessEnvironment::systemEnvironment() );
if ( !settings->restartCrashedSessionScript.isEmpty() ) { if ( !settings->restartCrashedSessionScript.isEmpty() ) {
startProc.startDetached( settings->restartCrashedSessionScript); startProc.startDetached( settings->restartCrashedSessionScript);
} }
} }
void lc::MainWindow::on_CBDataTargetPath_activated( int argIndex ) void lc::MainWindow::on_CBDataTargetPath_activated( int argIndex )
@ -721,7 +760,8 @@ void lc::MainWindow::on_CBDataTargetPath_activated( int argIndex )
} }
// Open a folder chooser dialog for zTree data path // Open a folder chooser dialog for zTree data path
void lc::MainWindow::GetNewDataTargetPath() { void lc::MainWindow::GetNewDataTargetPath()
{
QFileDialog fileDialog{ this }; QFileDialog fileDialog{ this };
fileDialog.setFileMode( QFileDialog::Directory ); fileDialog.setFileMode( QFileDialog::Directory );
fileDialog.setDirectory( QDir::homePath() ); fileDialog.setDirectory( QDir::homePath() );
@ -749,7 +789,8 @@ void lc::MainWindow::on_ChBPrintanonymousreceipts_clicked()
} }
// Start session button actions // Start session button actions
void lc::MainWindow::on_PBStartSession_clicked() { void lc::MainWindow::on_PBStartSession_clicked()
{
if ( ui->CBzTreeVersion->currentIndex() == 0 ) { if ( ui->CBzTreeVersion->currentIndex() == 0 ) {
QMessageBox::information( this, tr( "No z-Tree version chosen" ), QMessageBox::information( this, tr( "No z-Tree version chosen" ),
@ -759,7 +800,7 @@ void lc::MainWindow::on_PBStartSession_clicked() {
} }
const QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes(); const QModelIndexList activatedItems = ui->TVClients->selectionModel()->selectedIndexes();
if( !ui->ChBSessionWithoutAttachedClients->isChecked() ) { if ( !ui->ChBSessionWithoutAttachedClients->isChecked() ) {
if ( !activatedItems.length() ) { if ( !activatedItems.length() ) {
QMessageBox::information( this, tr( "Canceled, no clients were chosen" ), QMessageBox::information( this, tr( "Canceled, no clients were chosen" ),
tr( "The start of a new session was canceled.\n" tr( "The start of a new session was canceled.\n"
@ -775,10 +816,10 @@ void lc::MainWindow::on_PBStartSession_clicked() {
anonymousReceiptsPlaceholder = ui->CBReplaceParticipantNames->currentText(); anonymousReceiptsPlaceholder = ui->CBReplaceParticipantNames->currentText();
} }
QVector< Client* > associatedClients; QVector< Client * > associatedClients;
for ( auto cit = activatedItems.cbegin(); cit != activatedItems.cend(); ++cit ) { for ( auto cit = activatedItems.cbegin(); cit != activatedItems.cend(); ++cit ) {
if ( ( *cit ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *cit ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *cit ).data( Qt::UserRole ).value< void* >() ); Client *client = static_cast< Client * >( ( *cit ).data( Qt::UserRole ).value< void * >() );
client->SetSessionPort( ui->SBPort->value() ); client->SetSessionPort( ui->SBPort->value() );
client->SetzLeafVersion( ui->CBzTreeVersion->currentText() ); client->SetzLeafVersion( ui->CBzTreeVersion->currentText() );
associatedClients.append( client ); associatedClients.append( client );
@ -786,21 +827,22 @@ void lc::MainWindow::on_PBStartSession_clicked() {
} }
this->lablib->StartNewSession ( associatedClients, anonymousReceiptsPlaceholder, this->lablib->StartNewSession ( associatedClients, anonymousReceiptsPlaceholder,
ui->ChBReceiptsForLocalClients->isChecked(), ui->ChBReceiptsForLocalClients->isChecked(),
ui->CBReceiptsHeader->currentText(), ui->CBReceiptsHeader->currentText(),
ui->CBDataTargetPath->currentText(), ui->CBDataTargetPath->currentText(),
static_cast< quint16 >( ui->SBPort->value() ), static_cast< quint16 >( ui->SBPort->value() ),
ui->CBzTreeVersion->currentText() ); ui->CBzTreeVersion->currentText() );
//Display the command line //Display the command line
QString cmd = this->lablib->getzLeafArgs( ui->SBPort->value(), ui->CBzTreeVersion->currentText()).join(" "); QString cmd = this->lablib->getzLeafArgs( ui->SBPort->value(),
ui->CBzTreeVersion->currentText()).join(" ");
ui->LEzLeafCommandline->setText(cmd); ui->LEzLeafCommandline->setText(cmd);
//Start z-Leaf on selected clients if checkbox is activated //Start z-Leaf on selected clients if checkbox is activated
if( ui->ChBautoStartClientZleaf->isChecked() ) { if ( ui->ChBautoStartClientZleaf->isChecked() ) {
for ( auto cit = activatedItems.cbegin(); cit != activatedItems.cend(); ++cit ) { for ( auto cit = activatedItems.cbegin(); cit != activatedItems.cend(); ++cit ) {
if ( ( *cit ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *cit ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *cit ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *cit ).data( Qt::UserRole ).value< void * >() );
client->StartZLeaf( nullptr, cmd ); client->StartZLeaf( nullptr, cmd );
} }
} }
@ -816,9 +858,10 @@ void lc::MainWindow::on_PBStartSession_clicked() {
void lc::MainWindow::on_PBKillzLeaf_clicked() void lc::MainWindow::on_PBKillzLeaf_clicked()
{ {
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->KillZLeaf(); client->KillZLeaf();
} }
} }
@ -826,9 +869,10 @@ void lc::MainWindow::on_PBKillzLeaf_clicked()
/* Admin tab functions */ /* Admin tab functions */
void lc::MainWindow::on_PBOpenFilesystem_clicked() { void lc::MainWindow::on_PBOpenFilesystem_clicked()
{
// Determine the correct user to be used // Determine the correct user to be used
QString * userToBeUsed = nullptr; QString *userToBeUsed = nullptr;
if ( ui->RBUseUserRoot->isChecked() ) { if ( ui->RBUseUserRoot->isChecked() ) {
userToBeUsed = new QString{ "root" }; userToBeUsed = new QString{ "root" };
} else { } else {
@ -836,16 +880,18 @@ void lc::MainWindow::on_PBOpenFilesystem_clicked() {
} }
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->OpenFilesystem( userToBeUsed ); client->OpenFilesystem( userToBeUsed );
} }
} }
delete userToBeUsed; delete userToBeUsed;
} }
void lc::MainWindow::on_PBExecute_clicked() { void lc::MainWindow::on_PBExecute_clicked()
{
// Get the command to be executed ... // Get the command to be executed ...
QString command = ui->CBCommandToExecute->currentText(); QString command = ui->CBCommandToExecute->currentText();
@ -860,9 +906,10 @@ void lc::MainWindow::on_PBExecute_clicked() {
qDebug() << "Executing command" << command << " on chosen clients."; qDebug() << "Executing command" << command << " on chosen clients.";
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->OpenTerminal( command, ui->RBUseUserRoot->isChecked() ); client->OpenTerminal( command, ui->RBUseUserRoot->isChecked() );
} }
} }
@ -870,7 +917,8 @@ void lc::MainWindow::on_PBExecute_clicked() {
} }
// Issue open terminal call // Issue open terminal call
void lc::MainWindow::on_PBOpenTerminal_clicked() { void lc::MainWindow::on_PBOpenTerminal_clicked()
{
QString pkeyPathUser; QString pkeyPathUser;
if ( ui->RBUseUserRoot->isChecked() ) { if ( ui->RBUseUserRoot->isChecked() ) {
pkeyPathUser = settings->pkeyPathRoot; pkeyPathUser = settings->pkeyPathRoot;
@ -878,9 +926,10 @@ void lc::MainWindow::on_PBOpenTerminal_clicked() {
pkeyPathUser = settings->pkeyPathUser; pkeyPathUser = settings->pkeyPathUser;
} }
QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes(); QModelIndexList activated_items = ui->TVClients->selectionModel()->selectedIndexes();
for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend(); ++it ) { for ( QModelIndexList::ConstIterator it = activated_items.cbegin(); it != activated_items.cend();
++it ) {
if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) { if ( ( *it ).data( Qt::DisplayRole ).type() != 0 ) {
Client *client = static_cast< Client* >( ( *it ).data( Qt::UserRole ).value< void * >() ); Client *client = static_cast< Client * >( ( *it ).data( Qt::UserRole ).value< void * >() );
client->OpenTerminal( QString{}, ui->RBUseUserRoot->isChecked() ); client->OpenTerminal( QString{}, ui->RBUseUserRoot->isChecked() );
} }
} }

@ -1,5 +1,5 @@
/* /*
* Copyright 2014-2016 Markus Prasser * Copyright 2014-2018 Markus Prasser, Tobias Weiss
* *
* This file is part of Labcontrol. * This file is part of Labcontrol.
* *
@ -43,16 +43,20 @@ namespace Ui {
class MainWindow; class MainWindow;
} }
class Settings;
//! The class containing the graphical user interface. //! The class containing the graphical user interface.
/*! /*!
This class represents the graphical user interface and all connected functionality. This class represents the graphical user interface and all connected functionality.
*/ */
class MainWindow : public QMainWindow { class MainWindow : public QMainWindow
{
Q_OBJECT Q_OBJECT
public: public:
explicit MainWindow( QWidget *argParent = nullptr ); explicit MainWindow(Settings *const argSettings,
~MainWindow(); QWidget *argParent = nullptr);
~MainWindow() override;
private slots: private slots:
void on_CBWebcamChooser_activated(int index); void on_CBWebcamChooser_activated(int index);
@ -85,10 +89,10 @@ private slots:
signals: signals:
/*Session actions*/ /*Session actions*/
void RequestNewDataTargetPath(); void RequestNewDataTargetPath();
void RequestNewSession( QVector< Client* > argAssocCl, QString argParticipNameReplacement, void RequestNewSession(QVector<Client *> argAssocCl, QString argParticipNameReplacement,
bool argPrintLocalReceipts, QString argReceiptsHeader, bool argPrintLocalReceipts, QString argReceiptsHeader,
QString argzTreeDataTargetPath, quint16 argzTreePort, QString argzTreeDataTargetPath, quint16 argzTreePort,
QString argzTreeVersion ); QString argzTreeVersion);
private: private:
//! Checks, if the user has administrative rights //! Checks, if the user has administrative rights
@ -103,21 +107,31 @@ private:
//! Sets up all used widgets //! Sets up all used widgets
void SetupWidgets(); void SetupWidgets();
QStandardItemModel *clients_view_model = nullptr; //! The view storing all clients data //! The view storing all clients data
QTimer *gui_update_timer = nullptr; //! A QTimer triggering updates of the graphical user interface QStandardItemModel *clients_view_model = nullptr;
QVector< QPixmap > icons; //! Vector of pixmaps storing the icons indicating the clients' statuses //! A QTimer triggering updates of the graphical user interface
Lablib *lablib = nullptr; //! Accumulator of all program logic being accessed by the GUI QTimer *gui_update_timer = nullptr;
bool localzLeavesAreRunning = false; //! Stores if a local z-Leaf instance is running on the server ('true' if local z-Leaf exists) //! Vector of pixmaps storing the icons indicating the clients' statuses
QButtonGroup *userChooseButtonGroup = nullptr; //! Used to group the radio buttons choosing which user shall be used for administrative client actions QVector<QPixmap> icons;
Ui::MainWindow *ui = nullptr; //! Pointer storing all GUI items //! Accumulator of all program logic being accessed by the GUI
QVector<QStandardItem *> *valid_items = nullptr; //! Stores all valid Client instances displayed by the table view, its main use is as iterable object for 'update_clients_table_view()' Lablib *lablib = nullptr;
//! Stores if a local z-Leaf instance is running on the server ('true' if local z-Leaf exists)
bool localzLeavesAreRunning = false;
Settings *const settings = nullptr;
//! Used to group the radio buttons choosing which user shall be used for administrative client actions
QButtonGroup *userChooseButtonGroup = nullptr;
//! Pointer storing all GUI items
Ui::MainWindow *const ui = nullptr;
//! Stores all valid Client instances displayed by the table view, its main use is as iterable object for 'update_clients_table_view()'
QVector<QStandardItem *> *valid_items = nullptr;
private slots: private slots:
void StartReceiptsHandler( QString argzTreeDataTargetPath, void StartReceiptsHandler(QString argzTreeDataTargetPath,
bool argReceiptsForLocalClients, bool argReceiptsForLocalClients,
QString argAnonymousReceiptsPlaceholder, QString argAnonymousReceiptsPlaceholder,
QString argLatexHeaderName, QString argLatexHeaderName,
QString argDateString ); QString argDateString
);
void on_PBstartBrowser_clicked(); void on_PBstartBrowser_clicked();
void on_PBstopBrowser_clicked(); void on_PBstopBrowser_clicked();
@ -125,12 +139,12 @@ private slots:
void on_PBStopZtree_clicked(); void on_PBStopZtree_clicked();
void on_PBRecoverCrashedSession_clicked(); void on_PBRecoverCrashedSession_clicked();
void GetNewDataTargetPath(); void GetNewDataTargetPath();
void on_CBDataTargetPath_activated( int argIndex ); void on_CBDataTargetPath_activated(int argIndex);
void on_CBReceiptsHeader_activated(int argIndex); void on_CBReceiptsHeader_activated(int argIndex);
void on_ChBPrintanonymousreceipts_clicked(); void on_ChBPrintanonymousreceipts_clicked();
void on_PBKillzLeaf_clicked(); void on_PBKillzLeaf_clicked();
}; };
} } // namespace lc
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

@ -17,13 +17,6 @@
* along with Labcontrol. If not, see <http://www.gnu.org/licenses/>. * along with Labcontrol. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* #include "manualprintingsetup.h"
#include "ui_manualprintingsetup.h"
#include "Lib/settings.h"
#include <QFileDialog>
*/
#include "manualprintingsetup.h" #include "manualprintingsetup.h"
#include "ui_manualprintingsetup.h" #include "ui_manualprintingsetup.h"
#include "Lib/settings.h" #include "Lib/settings.h"
@ -33,10 +26,10 @@
#include <memory> #include <memory>
extern std::unique_ptr<lc::Settings> settings; lc::ManualPrintingSetup::ManualPrintingSetup(const Settings *const argSettings,
QWidget *argParent) :
lc::ManualPrintingSetup::ManualPrintingSetup(QWidget *argParent) :
QWidget{argParent}, QWidget{argParent},
settings{argSettings},
ui{new Ui::ManualPrintingSetup} ui{new Ui::ManualPrintingSetup}
{ {
ui->setupUi(this); ui->setupUi(this);

@ -28,12 +28,15 @@ namespace Ui {
class ManualPrintingSetup; class ManualPrintingSetup;
} // namespace Ui } // namespace Ui
class Settings;
class ManualPrintingSetup : public QWidget class ManualPrintingSetup : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit ManualPrintingSetup(QWidget *argParent = nullptr); explicit ManualPrintingSetup(const Settings *const argSettings,
QWidget *argParent = nullptr);
~ManualPrintingSetup() override; ~ManualPrintingSetup() override;
signals: signals:
@ -45,6 +48,7 @@ signals:
private: private:
QString dateString; QString dateString;
const Settings *const settings = nullptr;
Ui::ManualPrintingSetup *const ui = nullptr; Ui::ManualPrintingSetup *const ui = nullptr;
QString workPath; QString workPath;

Loading…
Cancel
Save