Explorar o código

Merge pull request #2 from fiffty-50/master

Added about button and legal information
Felix Turowsky %!s(int64=4) %!d(string=hai) anos
pai
achega
14027ed1f8
Modificáronse 5 ficheiros con 71 adicións e 0 borrados
  1. 13 0
      dbsettings.cpp
  2. 2 0
      dbsettings.h
  3. 40 0
      settingswidget.cpp
  4. 2 0
      settingswidget.h
  5. 14 0
      settingswidget.ui

+ 13 - 0
dbsettings.cpp

@@ -78,3 +78,16 @@ QVector<QString> dbSettings::retreiveSettingInfo(QString setting_id)
     }
     return setting;
 }
+
+QString dbSettings::sqliteversion()
+{
+    QSqlQuery version;
+    version.prepare("SELECT sqlite_version()");
+    version.exec();
+    QString result;
+
+    while (version.next()) {
+        result.append(version.value(0).toString());
+    }
+    return result;
+}

+ 2 - 0
dbsettings.h

@@ -37,6 +37,8 @@ public:
     static QString retreiveSetting(int setting_id);
 
     static QVector<QString> retreiveSettingInfo(QString setting_id);
+
+    static QString sqliteversion();
 };
 
 #endif // DBSETTINGS_H

+ 40 - 0
settingswidget.cpp

@@ -85,3 +85,43 @@ void settingsWidget::themeGroup_toggled(int id)
     info->setText("Theme change will take effect next time you start the application.");
     info->exec();
 }
+
+void settingsWidget::on_aboutPushButton_clicked()
+{
+    auto mb = new QMessageBox(this);
+    QString SQLITE_VERSION = dbSettings::sqliteversion();
+    QString text = QMessageBox::tr(
+
+                "<h3><center>About openPilotLog</center></h3>"
+                "<br>"
+                "(c) 2020 Felix Turowsky"
+                "<br>"
+                "<p>This is a collaboratively developed Free and Open Source Application. "
+                "Visit us <a href=\"https://%1/\">here</a> for more information.</p>"
+
+                "<p>This program is free software: you can redistribute it and/or modify "
+                "it under the terms of the GNU General Public License as published by "
+                "the Free Software Foundation, either version 3 of the License, or "
+                "(at your option) any later version.</p>"
+
+                "<p>This program is distributed in the hope that it will be useful, "
+                "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+                "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
+                "GNU General Public License for more details.</p> "
+
+                "<p>You should have received a copy of the GNU General Public License "
+                "along with this program.  If not, "
+                "please click <a href=\"https://www.gnu.org/licenses/\">here</a>.</p>"
+
+                "<br>"
+
+                "<p>This program uses <a href=\"http://%2/\">Qt</a> version %3 and "
+                "<a href=\"https://sqlite.org/about.html/\">SQLite</a> version %4</p>"
+                ).arg(QLatin1String("github.com/fiffty-50/openpilotlog"),
+                      QLatin1String("qt.io"),
+                      QLatin1String(QT_VERSION_STR),
+                      QString(SQLITE_VERSION));
+
+    mb->setText(text);
+    mb->open();
+}

+ 2 - 0
settingswidget.h

@@ -43,6 +43,8 @@ private slots:
 
     void themeGroup_toggled(int id);
 
+    void on_aboutPushButton_clicked();
+
 private:
     Ui::settingsWidget *ui;
 };

+ 14 - 0
settingswidget.ui

@@ -85,6 +85,20 @@
        </property>
       </widget>
      </widget>
+     <widget class="QWidget" name="aboutTab">
+      <attribute name="title">
+       <string>About</string>
+      </attribute>
+      <layout class="QGridLayout" name="gridLayout_3">
+       <item row="0" column="0">
+        <widget class="QPushButton" name="aboutPushButton">
+         <property name="text">
+          <string>About openPilotLog</string>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
   </layout>