This commit is contained in:
Thomas resiX 2025-02-15 08:38:24 +01:00
parent 3785fa8c6c
commit ac35692272
3 changed files with 317 additions and 301 deletions

View file

@ -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 = " \
<html> \
<head> \
@ -575,7 +585,7 @@ if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked";
</head> \
<body> \
<table> \
<tr><td rowspan=19><img src='" + Dateiname + ".png'></td><td>&nbsp;</td></tr> \
<tr><td rowspan=19><img src='png/" + Dateiname + ".png'></td><td rowspan=19>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
@ -595,17 +605,51 @@ if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked";
<tr><td align=right>Jahr :</td><td>" + ui->lineEdit_jahr->text() + "</td></tr> \
<tr><td align=right>FSK :</td><td>" + ui->comboBox_fsk->currentText() + "</td></tr> \
</table> \
<br><br><code>" + ui->plainTextEdit_handlung->toPlainText() + " </code> \
<br><br><code>" + ui->plainTextEdit_handlung->document()->toRawText() + " </code> \
</body> \
</htnl> \
";
";
#elif __linux__
html = " \
<html> \
<head> \
<title>Video-Datenbak</title> \
</head> \
<body> \
<table> \
<tr><td rowspan=19><img src='.Video-Datenbank/png/" + Dateiname + ".png'></td><td rowspan=19>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td>&nbsp;</td><td>&nbsp;</td></tr> \
<tr><td align=right>Pfad :</td><td>" + ui->pushButton_pfad->text() + "</td></tr> \
<tr><td align=right>Titel :</td><td>" + ui->lineEdit_titel->text() + "</td></tr> \
<tr><td align=right>Format :</td><td>" + ui->comboBox_bildformat->currentText() + "</td></tr> \
<tr><td align=right>Typ :</td><td>" + ui->comboBox_filmtyp->currentText() + "</td></tr> \
<tr><td align=right>Teil :</td><td>" + ui->lineEdit_teil->text() + "</td></tr> \
<tr><td align=right>Genre :</td><td>" + ui->comboBox_genre->currentText() + "</td></tr> \
<tr><td align=right>Länge :</td><td>" + ui->lineEdit_laenge->text() + "</td></tr> \
<tr><td align=right>Jahr :</td><td>" + ui->lineEdit_jahr->text() + "</td></tr> \
<tr><td align=right>FSK :</td><td>" + ui->comboBox_fsk->currentText() + "</td></tr> \
</table> \
<br><br><code>" + ui->plainTextEdit_handlung->document()->toRawText() + " </code> \
</body> \
</htnl> \
";
#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);

View file

@ -55,7 +55,6 @@ private:
void schiesseDatenbank();
void leseVerzeichnis();
int Debug;
QString fileName;
QString datenPfad;
Ui::MainWindow *ui;
QSqlDatabase db;

View file

@ -6,313 +6,200 @@
<rect>
<x>0</x>
<y>0</y>
<width>1156</width>
<height>716</height>
<width>935</width>
<height>562</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout_5">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_Videodaten">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="5" column="9">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Länge</string>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="13">
<widget class="QComboBox" name="comboBox_fsk"/>
</item>
<item row="2" column="3">
<widget class="QComboBox" name="comboBox_filmtyp"/>
</item>
<item row="2" column="8">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Länge</string>
</property>
</widget>
</item>
<item row="2" column="5">
<widget class="QLineEdit" name="lineEdit_teil"/>
</item>
<item row="2" column="10">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Jahr</string>
</property>
</widget>
</item>
<item row="2" column="12">
<widget class="QLabel" name="label_4">
<property name="text">
<string>FSK</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="comboBox_bildformat"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Pfad</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Format</string>
</property>
</widget>
</item>
<item row="2" column="6">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Genre</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Titel</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLabel" name="label">
<property name="text">
<string>Teil</string>
</property>
</widget>
</item>
<item row="2" column="11">
<widget class="QLineEdit" name="lineEdit_jahr"/>
</item>
<item row="2" column="7">
<widget class="QComboBox" name="comboBox_genre"/>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Typ</string>
</property>
</widget>
</item>
<item row="2" column="9">
<widget class="QLineEdit" name="lineEdit_laenge"/>
</item>
<item row="3" column="0" colspan="14">
<widget class="QPlainTextEdit" name="plainTextEdit_handlung">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>200</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1" colspan="13">
<widget class="QLineEdit" name="lineEdit_titel"/>
</item>
<item row="0" column="1" colspan="13">
<widget class="QPushButton" name="pushButton_pfad">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="2" colspan="13">
<widget class="QPushButton" name="pushButton_pfad">
<item row="0" column="2">
<widget class="QLabel" name="label_bild">
<property name="minimumSize">
<size>
<width>210</width>
<height>297</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>297</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="5" column="7">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Genre</string>
</property>
</widget>
</item>
<item row="5" column="11">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Jahr</string>
</property>
</widget>
</item>
<item row="5" column="10">
<widget class="QLineEdit" name="lineEdit_laenge"/>
</item>
<item row="5" column="3">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Typ</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="15">
<widget class="QPlainTextEdit" name="plainTextEdit_handlung"/>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Pfad</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QComboBox" name="comboBox_bildformat"/>
</item>
<item row="5" column="13">
<widget class="QLabel" name="label_4">
<property name="text">
<string>FSK</string>
</property>
</widget>
</item>
<item row="5" column="5">
<widget class="QLabel" name="label">
<property name="text">
<string>Teil</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Format</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Titel</string>
</property>
</widget>
</item>
<item row="5" column="8">
<widget class="QComboBox" name="comboBox_genre"/>
</item>
<item row="5" column="12">
<widget class="QLineEdit" name="lineEdit_jahr"/>
</item>
<item row="5" column="14">
<widget class="QComboBox" name="comboBox_fsk"/>
</item>
<item row="4" column="2" colspan="13">
<widget class="QLineEdit" name="lineEdit_titel"/>
</item>
<item row="5" column="4">
<widget class="QComboBox" name="comboBox_filmtyp"/>
</item>
<item row="5" column="6">
<widget class="QLineEdit" name="lineEdit_teil"/>
</item>
<item row="8" column="1">
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Suchen</string>
</property>
</widget>
</item>
<item row="8" column="2" colspan="13">
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_suchen"/>
</item>
<item row="9" column="0" rowspan="9" colspan="15">
<widget class="QTableWidget" name="tableWidget_Datenbank_ausgabe"/>
</item>
<item row="1" column="16" rowspan="17">
<widget class="QGroupBox" name="groupBox_Bild">
<item row="1" column="2" rowspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="5" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_PDF_Status">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_PDF_speichern">
<property name="text">
<string>PDF speichern</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_abspielen">
<property name="text">
<string>Abspielen</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_speichern">
<property name="text">
<string>Speichern</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="5">
<widget class="QPushButton" name="pushButton_bild">
<property name="text">
<string>Bild</string>
</property>
</widget>
</item>
<item row="7" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>/</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_id">
<property name="minimumSize">
<size>
<width>42</width>
<height>23</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="pushButton_plus">
<property name="minimumSize">
<size>
<width>42</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>42</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&gt;</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_minus">
<property name="minimumSize">
<size>
<width>42</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>42</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&lt;</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pushButton_max">
<property name="minimumSize">
<size>
<width>42</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_bild">
<item row="1" column="1">
<widget class="QPushButton" name="pushButton_id">
<property name="minimumSize">
<size>
<width>210</width>
<height>297</height>
<width>42</width>
<height>23</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>210</width>
<height>297</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
@ -320,32 +207,118 @@
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="pushButton_status">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="pushButton_plus">
<property name="minimumSize">
<size>
<width>42</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>42</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&gt;</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="pushButton_max">
<property name="minimumSize">
<size>
<width>42</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>70</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_7">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_status">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pushButton_daten_loeschen">
<property name="text">
<string>Daten löschen</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="pushButton_PDF_Status">
<property name="text">
<string>Status</string>
</property>
</widget>
</item>
<item row="2" column="3" colspan="2">
<widget class="QPushButton" name="pushButton_abspielen">
<property name="text">
<string>Abspielen</string>
</property>
</widget>
</item>
<item row="3" column="3" colspan="2">
<widget class="QPushButton" name="pushButton_daten_loeschen">
<property name="text">
<string>Daten löschen</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QPushButton" name="pushButton_speichern">
<property name="text">
<string>Speichern</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pushButton_minus">
<property name="minimumSize">
<size>
<width>42</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>42</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>&lt;</string>
</property>
</widget>
</item>
<item row="4" column="3" colspan="2">
<widget class="QPushButton" name="pushButton_PDF_speichern">
<property name="text">
<string>PDF speichern</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>/</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QTableWidget" name="tableWidget_Datenbank_ausgabe"/>
</item>
</layout>
</widget>
</item>
@ -356,7 +329,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>1156</width>
<width>935</width>
<height>21</height>
</rect>
</property>