annotate src/main.cpp @ 587:4ed384ea7f39 fswatcher

comment only
author Chris Cannam
date Wed, 14 Mar 2012 12:00:20 +0000
parents 533519ebc0cb
children 0e0844310914
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@560 8 Copyright (c) 2012 Chris Cannam
Chris@560 9 Copyright (c) 2012 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@256 28 QApplication app(argc, argv);
Chris@256 29
Chris@61 30 QApplication::setOrganizationName("easymercurial");
Chris@61 31 QApplication::setOrganizationDomain("easymercurial.org");
Chris@61 32 QApplication::setApplicationName(QApplication::tr("EasyMercurial"));
jtkorhonen@0 33
Chris@462 34 #ifdef Q_OS_MAC
Chris@462 35 // Mac doesn't align menu labels when icons are shown: result is messy
Chris@462 36 app.setAttribute(Qt::AA_DontShowIconsInMenus);
Chris@462 37 #endif
Chris@462 38
Chris@78 39 // Lose our controlling terminal (so we can provide a new pty to
Chris@78 40 // capture password requests)
Chris@78 41 loseControllingTerminal();
Chris@78 42
Chris@105 43 installSignalHandlers();
Chris@105 44
Chris@155 45 QTranslator translator;
Chris@155 46 QString language = QLocale::system().name();
Chris@493 47 if (language == "C") language = "en";
Chris@155 48 QString trname = QString("easyhg_%1").arg(language);
Chris@155 49 translator.load(trname, ":");
Chris@155 50 app.installTranslator(&translator);
Chris@155 51
Chris@145 52 QStringList args = app.arguments();
Chris@172 53
Chris@172 54 QString myDirPath = QFileInfo(QDir::current().absoluteFilePath(args[0]))
Chris@172 55 .canonicalPath();
Chris@172 56
Chris@172 57 MainWindow mainWin(myDirPath);
jtkorhonen@0 58 mainWin.show();
Chris@145 59
Chris@145 60 if (args.size() == 2) {
Chris@145 61 QString path = args[1];
Chris@145 62 DEBUG << "Opening " << args[1] << endl;
Chris@145 63 if (QDir(path).exists()) {
Chris@145 64 path = QDir(path).canonicalPath();
Chris@145 65 mainWin.open(path);
Chris@145 66 }
Chris@145 67 }
Chris@145 68
jtkorhonen@0 69 return app.exec();
jtkorhonen@0 70 }