annotate main.cpp @ 341:1fc2e0269ae0 help

Add Help button to multi-choice dialog
author Chris Cannam
date Tue, 15 Mar 2011 12:36:26 +0000
parents f649f6066e4d
children
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@244 8 Copyright (c) 2011 Chris Cannam
Chris@244 9 Copyright (c) 2011 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@78 34 // Lose our controlling terminal (so we can provide a new pty to
Chris@78 35 // capture password requests)
Chris@78 36 loseControllingTerminal();
Chris@78 37
Chris@105 38 installSignalHandlers();
Chris@105 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();
Chris@172 47
Chris@172 48 QString myDirPath = QFileInfo(QDir::current().absoluteFilePath(args[0]))
Chris@172 49 .canonicalPath();
Chris@172 50
Chris@172 51 MainWindow mainWin(myDirPath);
jtkorhonen@0 52 mainWin.show();
Chris@145 53
Chris@145 54 if (args.size() == 2) {
Chris@145 55 QString path = args[1];
Chris@145 56 DEBUG << "Opening " << args[1] << endl;
Chris@145 57 if (QDir(path).exists()) {
Chris@145 58 path = QDir(path).canonicalPath();
Chris@145 59 mainWin.open(path);
Chris@145 60 }
Chris@145 61 }
Chris@145 62
jtkorhonen@0 63 return app.exec();
jtkorhonen@0 64 }