annotate main.cpp @ 172:b6dd1ee0e486

* Fix failure to recognise local uncommitted changes when an untracked file was selected * Win32: Look in installed location (currently just the location of the present .exe) for executables as well as in path * Win32: Search for easyhg extension in same way as executables * Win32: Set installed location to path when running hg commands (for dependent DLLs)
author Chris Cannam
date Wed, 15 Dec 2010 22:07:31 +0000
parents edab92f3ea0b
children 8fd71f570884
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();
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 }