From ac3569227219828ac3f5331383a682cefecbc25c Mon Sep 17 00:00:00 2001 From: Thomas resiX Date: Sat, 15 Feb 2025 08:38:24 +0100 Subject: [PATCH] 3.2 --- mainwindow.cpp | 74 +++++-- mainwindow.h | 1 - mainwindow.ui | 543 +++++++++++++++++++++++-------------------------- 3 files changed, 317 insertions(+), 301 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index eecf00f..01a53d3 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -5,16 +5,20 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { - Debug = 1; + Debug = 0; if(Debug) qDebug() << "MainWindow"; #ifdef __WIN32__ if(Debug) qDebug() << "Windows Programm"; + QDir dir("pdf"); if (!dir.exists()) dir.mkdir(dir.absolutePath()); + dir.setPath("png"); if (!dir.exists()) dir.mkdir(dir.absolutePath()); #elif __linux__ if(Debug) qDebug() << "Linux Programm"; + QDir dir(".Video-Datenbank"); if (!dir.exists()) dir.mkdir(dir.absolutePath()); + dir.setPath(".Video-Datenbank/pdf"); if (!dir.exists()) dir.mkdir(dir.absolutePath()); + dir.setPath(".Video-Datenbank/png"); if (!dir.exists()) dir.mkdir(dir.absolutePath()); #endif ui->setupUi(this); - fileName = "Video-Datenbank.db"; oeffneDatenbank(); /*qApp->setStyleSheet("QWidget { color: #0c4909; \ @@ -40,10 +44,11 @@ if(Debug) qDebug() << "oeffneDatenbank"; QDateTime now = QDateTime::currentDateTime(); #ifdef __WIN32__ QString newName = "Video-Datenbank-Backup-" + now.toString("yyyy.MM.dd-hh.mm.ss") + ".db"; + QFile file("Video-Datenbank.db"); #elif __linux__ - QString newName = "./Video-Datenbank/Video-Datenbank-Backup.db"; + QString newName = ".Video-Datenbank/Video-Datenbank-Backup.db"; + QFile file(".Video-Datenbank/Video-Datenbank.db"); #endif - QFile file(fileName); file.copy(newName); db = QSqlDatabase::addDatabase("QSQLITE"); @@ -51,7 +56,7 @@ if(Debug) qDebug() << "oeffneDatenbank"; #ifdef __WIN32__ db.setDatabaseName("Video-Datenbank.db"); #elif __linux__ - db.setDatabaseName("./Video-Datenbank/Video-Datenbank.db"); + db.setDatabaseName(".Video-Datenbank/Video-Datenbank.db"); #endif if(db.open()){ @@ -406,9 +411,9 @@ if(Debug) qDebug() << "on_tableWidget_Datenbank_ausgabe_cellClicked"; } // -> Dateiname #ifdef __WIN32__ - if(QFileInfo::exists(QString(Dateiname + ".pdf"))){ + if(QFileInfo::exists(QString("pdf/" + Dateiname + ".pdf"))){ #elif __linux__ - if(QFileInfo::exists(QString(".Video-Datenbak/" + Dateiname + ".pdf"))){ + if(QFileInfo::exists(QString(".Video-Datenbank/pdf/" + Dateiname + ".pdf"))){ #endif ui->pushButton_PDF_Status->setStyleSheet("background-color: #88ff88; border-radius: 3px;"); @@ -514,9 +519,9 @@ if(Debug) qDebug() << "on_pushButton_bild_clicked"; // id ermitteln ende #ifdef __WIN32__ - fileName = QFileDialog::getOpenFileName(this, tr("Öffne Bild"), "c:", tr("Bild Datei (*.png *.jpg *.gif *.bmp)")); + QString fileName = QFileDialog::getOpenFileName(this, tr("Öffne Bild"), "c:", tr("Bild Datei (*.png *.jpg *.gif *.bmp)")); #elif __linux__ - fileName = QFileDialog::getOpenFileName(this, tr("Öffne Bild"), "~", tr("Bild Datei (*.png *.jpg *.gif *.bmp)")); + QString fileName = QFileDialog::getOpenFileName(this, tr("Öffne Bild"), "~", tr("Bild Datei (*.png *.jpg *.gif *.bmp)")); #endif if(!(fileName=="")){ QFile file(fileName); @@ -565,9 +570,14 @@ if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked"; } // -> Dateiname - ui->label_bild->grab().save(Dateiname + ".png"); +#ifdef __WIN32__ + ui->label_bild->grab().save("png/" + Dateiname + ".png"); +#elif __linux__ + ui->label_bild->grab().save(".Video-Datenbank/png/" + Dateiname + ".png"); +#endif QString html; +#ifdef __WIN32__ html = " \ \ \ @@ -575,7 +585,7 @@ if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked"; \ \ \ - \ + \ \ \ \ @@ -595,17 +605,51 @@ if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked"; \ \
 
   
  
  
  
Jahr :" + ui->lineEdit_jahr->text() + "
FSK :" + ui->comboBox_fsk->currentText() + "
\ -

" + ui->plainTextEdit_handlung->toPlainText() + " \ +

" + ui->plainTextEdit_handlung->document()->toRawText() + " \ \ \ - "; + "; +#elif __linux__ + html = " \ + \ + \ + Video-Datenbak \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
   
  
  
  
  
  
  
  
  
  
Pfad :" + ui->pushButton_pfad->text() + "
Titel :" + ui->lineEdit_titel->text() + "
Format :" + ui->comboBox_bildformat->currentText() + "
Typ :" + ui->comboBox_filmtyp->currentText() + "
Teil :" + ui->lineEdit_teil->text() + "
Genre :" + ui->comboBox_genre->currentText() + "
Länge :" + ui->lineEdit_laenge->text() + "
Jahr :" + ui->lineEdit_jahr->text() + "
FSK :" + ui->comboBox_fsk->currentText() + "
\ +

" + ui->plainTextEdit_handlung->document()->toRawText() + " \ + \ + \ + "; +#endif + QTextDocument doc; doc.setHtml(html); QPrinter printer; #ifdef __WIN32__ - printer.setOutputFileName(Dateiname + ".pdf"); + printer.setOutputFileName("pdf/" + Dateiname + ".pdf"); #elif __linux__ - printer.setOutputFileName("./Video-Datenbank/" + Dateiname + ".pdf"); + printer.setOutputFileName(".Video-Datenbank/pdf/" + Dateiname + ".pdf"); #endif printer.setOutputFormat(QPrinter::PdfFormat); doc.print(&printer); diff --git a/mainwindow.h b/mainwindow.h index 781e5f6..9db3d6c 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -55,7 +55,6 @@ private: void schiesseDatenbank(); void leseVerzeichnis(); int Debug; - QString fileName; QString datenPfad; Ui::MainWindow *ui; QSqlDatabase db; diff --git a/mainwindow.ui b/mainwindow.ui index cf27be9..eb7f4a2 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,313 +6,200 @@ 0 0 - 1156 - 716 + 935 + 562 MainWindow - + - - - - - Länge + + + + + + + + + + + + + + + + Länge + + + + + + + + + + Jahr + + + + + + + FSK + + + + + + + + + + Pfad + + + + + + + Format + + + + + + + Genre + + + + + + + Titel + + + + + + + Teil + + + + + + + + + + + + + Typ + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 200 + + + + + + + + + + + + + + + - - + + + + + 210 + 297 + + + + + 1000 + 297 + + + + + 0 + 0 + + - - - - Genre - - - - - - - Jahr - - - - - - - - - - Typ - - - - - - - - - - Pfad - - - - - - - - - - FSK - - - - - - - Teil - - - - - - - Format - - - - - - - Titel - - - - - - - - - - - - - - - - - - - - - - + Suchen - + - - - - - + + - - - - - - - - - - - Status - - - - - - - PDF speichern - - - - - - - - - - - - - - - - Abspielen - - - - - - - Speichern - - - - - - - + + Bild - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - / - - - - - - - - 42 - 23 - - - - - 70 - 16777215 - - - - - - - - - - - - 42 - 0 - - - - - 42 - 16777215 - - - - > - - - - - - - - 42 - 0 - - - - - 42 - 16777215 - - - - < - - - - - - - - 42 - 0 - - - - - 70 - 16777215 - - - - - - - - - - - - + + - 210 - 297 + 42 + 23 - 210 - 297 - - - - - 0 - 0 + 70 + 16777215 @@ -320,32 +207,118 @@ - - - + + + + Status + + + + + + + + 42 + 0 + + + + + 42 + 16777215 + + + + > + + + + + + + + 42 + 0 + + + + + 70 + 16777215 + + + - - - - - Status - - - - - - - Daten löschen - - - - + + + + + + Status + + + + + + + Abspielen + + + + + + + Daten löschen + + + + + + + Speichern + + + + + + + + 42 + 0 + + + + + 42 + 16777215 + + + + < + + + + + + + PDF speichern + + + + + + + / + + + + @@ -356,7 +329,7 @@ 0 0 - 1156 + 935 21