|
|
@ -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,83 +17,88 @@
|
|
|
|
* 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 <QFileDialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "manualprintingsetup.h"
|
|
|
|
#include "manualprintingsetup.h"
|
|
|
|
#include "ui_manualprintingsetup.h"
|
|
|
|
#include "ui_manualprintingsetup.h"
|
|
|
|
#include "Lib/settings.h"
|
|
|
|
#include "Lib/settings.h"
|
|
|
|
|
|
|
|
|
|
|
|
extern std::unique_ptr< lc::Settings > settings;
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
|
|
lc::ManualPrintingSetup::ManualPrintingSetup( QWidget *argParent ) :
|
|
|
|
extern std::unique_ptr<lc::Settings> settings;
|
|
|
|
QWidget{ argParent },
|
|
|
|
|
|
|
|
ui{ new Ui::ManualPrintingSetup }
|
|
|
|
lc::ManualPrintingSetup::ManualPrintingSetup(QWidget *argParent) :
|
|
|
|
|
|
|
|
QWidget{argParent},
|
|
|
|
|
|
|
|
ui{new Ui::ManualPrintingSetup}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ui->setupUi( this );
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
|
|
|
|
|
|
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()) {
|
|
|
|
ui->VLManualPrintingSetup->setEnabled( false );
|
|
|
|
ui->VLManualPrintingSetup->setEnabled(false);
|
|
|
|
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::ManualPrintingSetup::~ManualPrintingSetup() {
|
|
|
|
lc::ManualPrintingSetup::~ManualPrintingSetup()
|
|
|
|
|
|
|
|
{
|
|
|
|
delete ui;
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void lc::ManualPrintingSetup::on_PBSelectFile_clicked() {
|
|
|
|
void lc::ManualPrintingSetup::on_PBSelectFile_clicked()
|
|
|
|
QFileDialog fileDialog{ this, tr( "Please choose a payment file to print." ),
|
|
|
|
{
|
|
|
|
QDir::homePath(), "*.pay" };
|
|
|
|
QFileDialog fileDialog{this, tr("Please choose a payment file to print."),
|
|
|
|
fileDialog.setFileMode( QFileDialog::ExistingFile );
|
|
|
|
QDir::homePath(), "*.pay"};
|
|
|
|
fileDialog.setOption( QFileDialog::ReadOnly, true );
|
|
|
|
fileDialog.setFileMode(QFileDialog::ExistingFile);
|
|
|
|
if ( fileDialog.exec() ) {
|
|
|
|
fileDialog.setOption(QFileDialog::ReadOnly, true);
|
|
|
|
ui->PBSelectFile->setStyleSheet( "" );
|
|
|
|
if (fileDialog.exec()) {
|
|
|
|
const QString tmpFileName{ fileDialog.selectedFiles().at( 0 ) };
|
|
|
|
ui->PBSelectFile->setStyleSheet("");
|
|
|
|
dateString = tmpFileName.split( '/', QString::KeepEmptyParts,
|
|
|
|
const QString tmpFileName{fileDialog.selectedFiles().at(0)};
|
|
|
|
Qt::CaseInsensitive ).last()
|
|
|
|
dateString = tmpFileName.split('/', QString::KeepEmptyParts,
|
|
|
|
.split( '.', QString::KeepEmptyParts,
|
|
|
|
Qt::CaseInsensitive).last()
|
|
|
|
Qt::CaseInsensitive ).first();
|
|
|
|
.split('.', QString::KeepEmptyParts,
|
|
|
|
|
|
|
|
Qt::CaseInsensitive).first();
|
|
|
|
workPath = tmpFileName;
|
|
|
|
workPath = tmpFileName;
|
|
|
|
workPath.truncate( workPath.lastIndexOf( '/' ) );
|
|
|
|
workPath.truncate(workPath.lastIndexOf('/'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void lc::ManualPrintingSetup::on_CBReceiptsHeader_activated( int argIndex ) {
|
|
|
|
void lc::ManualPrintingSetup::on_CBReceiptsHeader_activated(const int argIndex)
|
|
|
|
Q_UNUSED( argIndex );
|
|
|
|
{
|
|
|
|
ui->CBReceiptsHeader->setStyleSheet( "" );
|
|
|
|
Q_UNUSED(argIndex);
|
|
|
|
|
|
|
|
ui->CBReceiptsHeader->setStyleSheet("");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void lc::ManualPrintingSetup::on_ChBPrintAnonymousReceipts_clicked( bool argChecked ) {
|
|
|
|
void lc::ManualPrintingSetup::on_ChBPrintAnonymousReceipts_clicked(const bool argChecked)
|
|
|
|
ui->ChBPrintAnonymousReceipts->setStyleSheet( "" );
|
|
|
|
{
|
|
|
|
|
|
|
|
ui->ChBPrintAnonymousReceipts->setStyleSheet("");
|
|
|
|
|
|
|
|
|
|
|
|
ui->LReplaceParticipantNames->setEnabled( argChecked );
|
|
|
|
ui->LReplaceParticipantNames->setEnabled(argChecked);
|
|
|
|
ui->CBReplaceParticipantNames->setEnabled( argChecked );
|
|
|
|
ui->CBReplaceParticipantNames->setEnabled(argChecked);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void lc::ManualPrintingSetup::on_PBPrint_clicked() {
|
|
|
|
void lc::ManualPrintingSetup::on_PBPrint_clicked()
|
|
|
|
|
|
|
|
{
|
|
|
|
QString anonymousReceiptsPlaceholder;
|
|
|
|
QString anonymousReceiptsPlaceholder;
|
|
|
|
if ( ui->ChBPrintAnonymousReceipts->isChecked() ) {
|
|
|
|
if (ui->ChBPrintAnonymousReceipts->isChecked()) {
|
|
|
|
anonymousReceiptsPlaceholder = ui->CBReplaceParticipantNames->currentText();
|
|
|
|
anonymousReceiptsPlaceholder = ui->CBReplaceParticipantNames->currentText();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
emit RequestReceiptsHandler( workPath, ui->ChBReceiptsForLocalClients->isChecked(),
|
|
|
|
emit RequestReceiptsHandler(workPath, ui->ChBReceiptsForLocalClients->isChecked(),
|
|
|
|
anonymousReceiptsPlaceholder,
|
|
|
|
anonymousReceiptsPlaceholder,
|
|
|
|
ui->CBReceiptsHeader->currentText(), dateString );
|
|
|
|
ui->CBReceiptsHeader->currentText(), dateString);
|
|
|
|
|
|
|
|
|
|
|
|
this->deleteLater();
|
|
|
|
this->deleteLater();
|
|
|
|
}
|
|
|
|
}
|
|
|
|