diff --git a/Video-Datenbank-128.png b/Video-Datenbank-128.png index 35da661..91838d0 100644 Binary files a/Video-Datenbank-128.png and b/Video-Datenbank-128.png differ diff --git a/Video-Datenbank-16.png b/Video-Datenbank-16.png index 20dcf28..13f316b 100644 Binary files a/Video-Datenbank-16.png and b/Video-Datenbank-16.png differ diff --git a/Video-Datenbank-256.png b/Video-Datenbank-256.png index 6f78f5d..bfceb55 100644 Binary files a/Video-Datenbank-256.png and b/Video-Datenbank-256.png differ diff --git a/Video-Datenbank-32.png b/Video-Datenbank-32.png index d8b8948..1f0b589 100644 Binary files a/Video-Datenbank-32.png and b/Video-Datenbank-32.png differ diff --git a/Video-Datenbank-48.png b/Video-Datenbank-48.png new file mode 100644 index 0000000..4dc7106 Binary files /dev/null and b/Video-Datenbank-48.png differ diff --git a/Video-Datenbank-64.png b/Video-Datenbank-64.png index 0c4de7b..0293713 100644 Binary files a/Video-Datenbank-64.png and b/Video-Datenbank-64.png differ diff --git a/Video-Datenbank.pro b/Video-Datenbank.pro index 9834967..47742f3 100644 --- a/Video-Datenbank.pro +++ b/Video-Datenbank.pro @@ -1,4 +1,4 @@ -QT += core gui sql printsupport +QT += core gui sql printsupport network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets diff --git a/mainwindow.cpp b/mainwindow.cpp index 00327ac..6e3a32c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -662,3 +662,61 @@ if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked"; if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked-Ende"; } + +void MainWindow::on_pushButton_Wikipedia_clicked(){ +if(Debug) qDebug() << "on_pushButton_Wikipedia_clicked-Ende"; + if(ui->lineEdit_titel->text()==""){ + QMessageBox msgBox; + msgBox.setText("Kein Titel zum Suchen!"); + msgBox.exec(); + return; + } + + QNetworkAccessManager manager; + QNetworkReply *reply = manager.get(QNetworkRequest(QUrl("https://de.wikipedia.org/w/api.php?action=query&list=search&srsearch=" + ui->lineEdit_titel->text() +"&srlimit=1&prop=info&inprop=url&utf8=&origin=*&format=json"))); + QEventLoop eventLoop; + QObject::connect(&manager, SIGNAL(finished(QNetworkReply*)), &eventLoop, SLOT(quit())); + eventLoop.exec(); + QJsonDocument getJD = QJsonDocument::fromJson(reply->readAll()); + QJsonObject getJO = getJD.object(); + QJsonValue queryJV = getJO.value(QString("query")); + QJsonArray searchJA = queryJV["search"].toArray(); + QJsonObject searchJO = searchJA[0].toObject(); + QJsonValue titelJV = searchJO.value(QString("title")); + + if(titelJV.toString()=="") return; + + reply = manager.get(QNetworkRequest(QUrl("https://de.wikipedia.org/w/api.php?action=parse&page=" + titelJV.toString() + "&prop=text&formatversion=2&format=json"))); + QObject::connect(&manager, SIGNAL(finished(QNetworkReply*)), &eventLoop, SLOT(quit())); + eventLoop.exec(); + getJD = QJsonDocument::fromJson(reply->readAll()); + getJO = getJD.object(); + QJsonValue parseJV = getJO.value(QString("parse")); + QJsonObject parseJO = parseJV.toObject(); + QJsonValue textJV = parseJO.value(QString("text")); + + if(textJV.toString()=="") return; + + QTextDocument htmlDoc; + htmlDoc.setHtml(textJV.toString()); + + QMessageBox messageBox; + messageBox.setStyleSheet("QTextEdit{min-width:800 px;height: 500px; min-height: 500px; max-height: 500px;}"); + messageBox.deleteLater(); + messageBox.setText(titelJV.toString()); + //messageBox.setDetailedText(html.remove(QRegExp("<[^>]*>"))); + messageBox.setDetailedText(htmlDoc.toRawText()); + QAbstractButton *detailsButton = NULL; + foreach (QAbstractButton *button, messageBox.buttons()) { + if (messageBox.buttonRole(button) == QMessageBox::ActionRole) { + detailsButton = button; + break; + } + } + if (detailsButton) { + detailsButton->click(); + } + messageBox.exec(); +if(Debug) qDebug() << "on_pushButton_Wikipedia_clicked-Ende"; +} + diff --git a/mainwindow.h b/mainwindow.h index 9db3d6c..ce863c0 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -13,6 +13,11 @@ #include <QDebug> #include <QTableWidgetItem> #include <QPrinter> +#include <QNetworkAccessManager> +#include <QNetworkReply> +#include <QJsonDocument> +#include <QJsonObject> +#include <QJsonArray> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -50,6 +55,8 @@ private slots: void on_pushButton_PDF_speichern_clicked(); + void on_pushButton_Wikipedia_clicked(); + private: void oeffneDatenbank(); void schiesseDatenbank(); diff --git a/mainwindow.ui b/mainwindow.ui index 3ee2ec5..6847461 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -7,7 +7,7 @@ <x>0</x> <y>0</y> <width>956</width> - <height>608</height> + <height>616</height> </rect> </property> <property name="windowTitle"> @@ -192,6 +192,41 @@ <bool>false</bool> </property> <layout class="QGridLayout" name="gridLayout_3"> + <item row="2" column="2" colspan="4"> + <widget class="QPushButton" name="pushButton_abspielen"> + <property name="text"> + <string>Abspielen</string> + </property> + </widget> + </item> + <item row="4" column="0" colspan="2"> + <widget class="QPushButton" name="pushButton_PDF_Status"> + <property name="text"> + <string>PDF</string> + </property> + </widget> + </item> + <item row="3" column="2" colspan="4"> + <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="4" column="2" colspan="4"> + <widget class="QPushButton" name="pushButton_PDF_speichern"> + <property name="text"> + <string>PDF speichern</string> + </property> + </widget> + </item> <item row="1" column="0"> <widget class="QPushButton" name="pushButton_minus"> <property name="minimumSize"> @@ -211,61 +246,12 @@ </property> </widget> </item> - <item row="1" column="2"> - <widget class="QLabel" name="label_9"> - <property name="text"> - <string>/</string> - </property> - </widget> - </item> - <item row="4" column="0" colspan="2"> - <widget class="QPushButton" name="pushButton_PDF_Status"> - <property name="text"> - <string>PDF</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="0" column="0" colspan="6"> - <widget class="QPushButton" name="pushButton_bild"> - <property name="text"> - <string>Bild</string> - </property> - </widget> - </item> - <item row="3" column="0" colspan="2"> - <widget class="QPushButton" name="pushButton_status"> - <property name="text"> - <string>Film</string> - </property> - </widget> - </item> - <item row="3" column="2" colspan="4"> - <widget class="QPushButton" name="pushButton_daten_loeschen"> - <property name="text"> - <string>Daten löschen</string> - </property> - </widget> - </item> - <item row="2" column="2" colspan="4"> - <widget class="QPushButton" name="pushButton_abspielen"> - <property name="text"> - <string>Abspielen</string> - </property> - </widget> - </item> - <item row="1" column="1"> - <widget class="QPushButton" name="pushButton_id"> + <item row="1" column="3"> + <widget class="QPushButton" name="pushButton_max"> <property name="minimumSize"> <size> <width>42</width> - <height>23</height> + <height>0</height> </size> </property> <property name="maximumSize"> @@ -279,19 +265,12 @@ </property> </widget> </item> - <item row="4" column="2" colspan="4"> - <widget class="QPushButton" name="pushButton_PDF_speichern"> - <property name="text"> - <string>PDF speichern</string> - </property> - </widget> - </item> - <item row="1" column="3"> - <widget class="QPushButton" name="pushButton_max"> + <item row="1" column="1"> + <widget class="QPushButton" name="pushButton_id"> <property name="minimumSize"> <size> <width>42</width> - <height>0</height> + <height>23</height> </size> </property> <property name="maximumSize"> @@ -324,6 +303,34 @@ </property> </widget> </item> + <item row="1" column="2"> + <widget class="QLabel" name="label_9"> + <property name="text"> + <string>/</string> + </property> + </widget> + </item> + <item row="0" column="0" colspan="6"> + <widget class="QPushButton" name="pushButton_bild"> + <property name="text"> + <string>Bild</string> + </property> + </widget> + </item> + <item row="3" column="0" colspan="2"> + <widget class="QPushButton" name="pushButton_status"> + <property name="text"> + <string>Film</string> + </property> + </widget> + </item> + <item row="5" column="0" colspan="6"> + <widget class="QPushButton" name="pushButton_Wikipedia"> + <property name="text"> + <string>Wikipedia</string> + </property> + </widget> + </item> </layout> </widget> </item> diff --git a/source.txt b/source.txt new file mode 100644 index 0000000..722be97 --- /dev/null +++ b/source.txt @@ -0,0 +1,11 @@ +https://openclipart.org/detail/212130/wmmaker + +Programmsymbol: sixsixfive (openclipart.org) +Remix: aer66 (created june 2022) +Creative Commons Zero 1.0 Public Domain License +creativecommons.org/publicdomain/zero/1.0 + +rodentia-icons_wmmaker +uploaded on January 10, 2015, 4:15 pm +an old rodentia icon theme once made for xfce, also keep in mind that it was based on a fixed color palette! +Safe for Work? Yes