annotate main.cpp @ 155:edab92f3ea0b

* Add translation support -- useful for proper plural handling even in English
author Chris Cannam
date Thu, 02 Dec 2010 21:13:53 +0000
parents 644bd31e8301
children b6dd1ee0e486
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@57 2
Chris@57 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@57 6 Based on HgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@57 8 Copyright (c) 2010 Chris Cannam
Chris@57 9 Copyright (c) 2010 Queen Mary, University of London
Chris@57 10
Chris@57 11 This program is free software; you can redistribute it and/or
Chris@57 12 modify it under the terms of the GNU General Public License as
Chris@57 13 published by the Free Software Foundation; either version 2 of the
Chris@57 14 License, or (at your option) any later version. See the file
Chris@57 15 COPYING included with this distribution for more information.
Chris@57 16 */
jtkorhonen@0 17
jtkorhonen@0 18 #include "mainwindow.h"
Chris@78 19 #include "common.h"
Chris@78 20 #include "debug.h"
jtkorhonen@0 21
Chris@145 22 #include <QApplication>
Chris@155 23 #include <QTranslator>
Chris@145 24 #include <QDir>
Chris@145 25
jtkorhonen@0 26 int main(int argc, char *argv[])
jtkorhonen@0 27 {
Chris@61 28 QApplication::setOrganizationName("easymercurial");
Chris@61 29 QApplication::setOrganizationDomain("easymercurial.org");
Chris@61 30 QApplication::setApplicationName(QApplication::tr("EasyMercurial"));
jtkorhonen@0 31
Chris@78 32 // Lose our controlling terminal (so we can provide a new pty to
Chris@78 33 // capture password requests)
Chris@78 34 loseControllingTerminal();
Chris@78 35
Chris@105 36 installSignalHandlers();
Chris@105 37
jtkorhonen@0 38 QApplication app(argc, argv);
Chris@155 39
Chris@155 40 QTranslator translator;
Chris@155 41 QString language = QLocale::system().name();
Chris@155 42 QString trname = QString("easyhg_%1").arg(language);
Chris@155 43 translator.load(trname, ":");
Chris@155 44 app.installTranslator(&translator);
Chris@155 45
Chris@145 46 QStringList args = app.arguments();
jtkorhonen@0 47 MainWindow mainWin;
jtkorhonen@0 48 mainWin.show();
Chris@145 49
Chris@145 50 if (args.size() == 2) {
Chris@145 51 QString path = args[1];
Chris@145 52 DEBUG << "Opening " << args[1] << endl;
Chris@145 53 if (QDir(path).exists()) {
Chris@145 54 path = QDir(path).canonicalPath();
Chris@145 55 mainWin.open(path);
Chris@145 56 }
Chris@145 57 }
Chris@145 58
jtkorhonen@0 59 return app.exec();
jtkorhonen@0 60 }