| 1 | /*********************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2010-2017 Innocent De Marchi <[email protected]> |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | * |
| 18 | ***********************************************************************/ |
| 19 | #include <QApplication> |
| 20 | #include <QTranslator> |
| 21 | #include <QTextCodec> |
| 22 | #include <QLocale> |
| 23 | #include <QtCore> |
| 24 | #include <QtWidgets/QSplashScreen> |
| 25 | #include "frmprincipal.h" |
| 26 | #include "funcions.h" |
| 27 | |
| 28 | QTranslator *qt_translator; |
| 29 | QTranslator *appTranslator; |
| 30 | |
| 31 | int main(int argc, char *argv[]) |
| 32 | { |
| 33 | QApplication app(argc, argv); |
| 34 | app.setApplicationName("Solitari"); |
| 35 | app.setApplicationVersion("2.2"); |
| 36 | app.setOrganizationName("De Marchi"); |
| 37 | |
| 38 | //Això pels accents a les cadenes |
| 39 | QTextCodec *linuxCodec = QTextCodec::codecForName("UTF-8"); |
| 40 | // QTextCodec::setCodecForTr(linuxCodec); |
| 41 | // QTextCodec::setCodecForCStrings(linuxCodec); |
| 42 | QTextCodec::setCodecForLocale(linuxCodec); |
| 43 | |
| 44 | QPixmap pixmap(directoriLinux()+QDir().separator()+"images"+QDir().separator()+"asimetric_jugant.png"); |
| 45 | QSplashScreen splash(pixmap); |
| 46 | splash.show(); |
| 47 | //Sense aquesta línia,la imatge no s'actualitza |
| 48 | splash.showMessage(""); |
| 49 | |
| 50 | //Això per a que surtin traduïdes les cadenes dels formularis predefinits Qt |
| 51 | QString qt_translatorFileName = QLatin1String("qt_"); |
| 52 | qt_translatorFileName += QLocale::system().name(); |
| 53 | |
| 54 | qt_translator = new QTranslator(); |
| 55 | if (qt_translator->load(qt_translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) |
| 56 | app.installTranslator(qt_translator); |
| 57 | //15/02/15 A windows cal posar |
| 58 | /*if (qt_translator->load(qt_translatorFileName, QApplication::applicationDirPath())) |
| 59 | app.installTranslator(translator);*/ |
| 60 | |
| 61 | //Això per les traduccions |
| 62 | appTranslator= new QTranslator(); |
| 63 | appTranslator->load("solitari_" + QLocale::system().name(), app.applicationDirPath()+QDir().separator()+"locales"); |
| 64 | |
| 65 | app.installTranslator(appTranslator); |
| 66 | |
| 67 | frmPrincipal *frmMDI=new frmPrincipal(); |
| 68 | frmMDI->show(); |
| 69 | |
| 70 | splash.finish(frmMDI); |
| 71 | return app.exec(); |
| 72 | } |