| 1 | /* |
| 2 | Copyright (C) 2005-2014 Mario Stephan <[email protected]> |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as published |
| 6 | by the Free Software Foundation; either version 2.1 of the License, or |
| 7 | (at your option) any later version. |
| 8 | |
| 9 | This program is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | GNU General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public License |
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | |
| 18 | #include "knowthelist.h"cxx . . $ `<file>/src/knowthelist.h`/ |
| 19 | |
| 20 | #include <QApplication> |
| 21 | #include <QMessageBox> |
| 22 | #include <QTextCodec> |
| 23 | #include <QTranslator> |
| 24 | #include <QtSql> |
| 25 | |
| 26 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char* argv[]) |
| 27 | { |
| 28 | QApplicationcxx . . $ QApplication# acxx . . $ QApplication#QApplication(6e9b1c7df49e191d).(argc, argv); |
| 29 | |
| 30 | // init rand |
| 31 | qsrandcxx . . $ qsrand(cb2f890c2fdad230).(QDateTimecxx . . $ QDateTime#::currentMSecsSinceEpochcxx . . $ QDateTime#currentMSecsSinceEpoch(9969456818c7299).() / 1000); |
| 32 | |
| 33 | QTextCodeccxx . . $ QTextCodec#::setCodecForLocalecxx . . $ QTextCodec#setCodecForLocale(1f30447839ed391).(QTextCodeccxx . . $ QTextCodec#::codecForNamecxx . . $ QTextCodec#codecForName(914382192c9ca379).("UTF-8")); |
| 34 | a.setQuitOnLastWindowClosedcxx . . $ QGuiApplication#setQuitOnLastWindowClosed(b45ddcbc8423892c).(true); |
| 35 | |
| 36 | QCoreApplicationcxx . . $ QCoreApplication#::setOrganizationNamecxx . . $ QCoreApplication#setOrganizationName(3520e46b33348bf6).("knowthelist-org"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 37 | QCoreApplicationcxx . . $ QCoreApplication#::setOrganizationDomaincxx . . $ QCoreApplication#setOrganizationDomain(3520e46b33348bf6).(""cxx . . $ QString#QString(85c52e162fed56f9).); |
| 38 | QCoreApplicationcxx . . $ QCoreApplication#::setApplicationNamecxx . . $ QCoreApplication#setApplicationName(3520e46b33348bf6).("knowthelist"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 39 | QCoreApplicationcxx . . $ QCoreApplication#::setApplicationVersioncxx . . $ QCoreApplication#setApplicationVersion(3520e46b33348bf6).("2.3.1"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 40 | |
| 41 | QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(749de1b6ae65bddd).; |
| 42 | QStringListcxx . . $ QStringList# languagescxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 43 | languages <<cxx . . $ QStringList#`operator<<`(85116071a693d053). ""cxx . . $ QString#QString(85c52e162fed56f9). |
| 44 | <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "en"cxx . . $ QString#QString(85c52e162fed56f9). |
| 45 | <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "de"cxx . . $ QString#QString(85c52e162fed56f9). |
| 46 | <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "cs"cxx . . $ QString#QString(85c52e162fed56f9). |
| 47 | <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "hu"cxx . . $ QString#QString(85c52e162fed56f9). |
| 48 | <<cxx . . $ QStringList#`operator<<`(85116071a693d053). "fr"cxx . . $ QString#QString(85c52e162fed56f9).; |
| 49 | QStringcxx . . $ QString# lang = languagescxx . . $ QString#QString(132dd6869045752b).[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("language"cxx . . $ QString#QString(85c52e162fed56f9)., 0cxx . . $ QVariant#QVariant(d4f767463ce0a6b3).).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).()]; |
| 50 | if (lang.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 51 | lang =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QLocalecxx . . $ QLocale#::systemcxx . . $ QLocale#system(7171962d3a2fd395).().namecxx . . $ QLocale#name(6ef7b6c27b00b43d).(); |
| 52 | |
| 53 | QTranslatorcxx . . $ QTranslator# qtTranslatorcxx . . $ QTranslator#QTranslator(749de1b6ae65bddd).; |
| 54 | qtTranslator.loadcxx . . $ QTranslator#load(142924642d8b819d).("qt_" +cxx . . $ operator+(c75c3ae4eb9af1a8). lang, |
| 55 | QLibraryInfocxx . . $ QLibraryInfo#::locationcxx . . $ QLibraryInfo#location(dd7ac78f10b8a525).(QLibraryInfocxx . . $ QLibraryInfo#::TranslationsPathcxx . . $ QLibraryInfo#TranslationsPath.)); |
| 56 | a.installTranslatorcxx . . $ QCoreApplication#installTranslator(d376406de50edad7).(&qtTranslator); |
| 57 | |
| 58 | QTranslatorcxx . . $ QTranslator# localizationcxx . . $ QTranslator#QTranslator(749de1b6ae65bddd).; |
| 59 | bool result = localization.loadcxx . . $ QTranslator#load(142924642d8b819d).(":knowthelist_" +cxx . . $ operator+(c75c3ae4eb9af1a8). lang +cxx . . $ operator+(3d22f08efddf8107). ".qm"); |
| 60 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "localization load " |
| 61 | <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). ":knowthelist_" +cxx . . $ operator+(c75c3ae4eb9af1a8). lang +cxx . . $ operator+(3d22f08efddf8107). ".qm result:" <<cxx . . $ QDebug#`operator<<`(4e09def0874f8c94). result; |
| 62 | a.installTranslatorcxx . . $ QCoreApplication#installTranslator(d376406de50edad7).(&localization); |
| 63 | |
| 64 | if (!QSqlDatabasecxx . . $ QSqlDatabase#::driverscxx . . $ QSqlDatabase#drivers(669a05bc42dd57cc).().containscxx . . $ QStringList#contains(8cce4688c16f48f3).("QSQLITE"cxx . . $ QString#QString(85c52e162fed56f9).)) { |
| 65 | #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= 0x050000 |
| 66 | QMessageBoxcxx . . $ QMessageBox#::criticalcxx . . $ QMessageBox#critical(a9e3742e6f7b4147).(nullptr, QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("Unable to load database"), |
| 67 | QObjectcxx . . $ QObject#::trcxx . . $ QObject#tr(75d9f1c324b4579d).("This application needs the QT5 SQLITE " |
| 68 | "driver (libqt5-sql-sqlite)")); |
| 69 | #else |
| 70 | QMessageBox::critical(0, QObject::tr("Unable to load database"), |
| 71 | QObject::tr("This application needs the QT4 SQLITE " |
| 72 | "driver (libqt4-sql-sqlite)")); |
| 73 | #endif |
| 74 | |
| 75 | return 1; |
| 76 | } |
| 77 | |
| 78 | #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= 0x050000 |
| 79 | QStringcxx . . $ QString# pathName = QStandardPathscxx . . $ QString#QString(132dd6869045752b).::standardLocationscxx . . $ QStandardPaths#standardLocations(88c3720734e7e359).(QStandardPathscxx . . $ QStandardPaths#::DataLocationcxx . . $ QStandardPaths#DataLocation.).atcxx . . $ QList#at(e2681f9bb6b2f357).(0); |
| 80 | #else |
| 81 | QString pathName = QDesktopServices::storageLocation(QDesktopServices::DataLocation); |
| 82 | #endif |
| 83 | QDircxx . . $ QDir# pathcxx . . $ QDir#QDir(3520e46b33348bf6).(pathName); |
| 84 | |
| 85 | if (!path.existscxx . . $ QDir#exists(50ce9a9e25b4a850).()) |
| 86 | path.mkpathcxx . . $ QDir#mkpath(f3b39adf77d9c36c).(pathName); |
| 87 | |
| 88 | QSqlDatabasecxx . . $ QSqlDatabase# db = QSqlDatabasecxx . . $ QSqlDatabase#::addDatabasecxx . . $ QSqlDatabase#addDatabase(660a07b34cb8c61b).("QSQLITE"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 89 | db.setDatabaseNamecxx . . $ QSqlDatabase#setDatabaseName(3520e46b33348bf6).(path.absolutePathcxx . . $ QDir#absolutePath(6ef7b6c27b00b43d).() +cxx . . $ operator+(3d22f08efddf8107). "/collection.db"); |
| 90 | |
| 91 | if (!db.opencxx . . $ QSqlDatabase#open(c9857a73d68e59ba).()) { |
| 92 | QMessageBoxcxx . . $ QMessageBox#::criticalcxx . . $ QMessageBox#critical(a9e3742e6f7b4147).(nullptr, "fatal database error"cxx . . $ QString#QString(85c52e162fed56f9)., |
| 93 | db.lastErrorcxx . . $ QSqlDatabase#lastError(b02d9d6c0f4da678).().textcxx . . $ QSqlError#text(6ef7b6c27b00b43d).()); |
| 94 | return 1; |
| 95 | } |
| 96 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "load database: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). db.databaseNamecxx . . $ QSqlDatabase#databaseName(6ef7b6c27b00b43d).(); |
| 97 | Knowthelistcxx . . $ Knowthelist# wcxx . . $ Knowthelist#Knowthelist(108f35f7aa7f3cf9).; |
| 98 | w.showcxx . . $ QWidget#show(49f6e7a06ebc5aa8).(); |
| 99 | |
| 100 | return a.execcxx . . $ QApplication#exec(b126dc7c1de90089).(); |
| 101 | } |