annotate src/main.cpp @ 462:110d1fefa073

Omit icons from menus on Mac
author Chris Cannam
date Thu, 30 Jun 2011 09:43:29 +0100
parents b9c153e00e84
children 75ebcacd3f75
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@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@155 47 QString trname = QString("easyhg_%1").arg(language);
Chris@155 48 translator.load(trname, ":");
Chris@155 49 app.installTranslator(&translator);
Chris@155 50
Chris@145 51 QStringList args = app.arguments();
Chris@172 52
Chris@172 53 QString myDirPath = QFileInfo(QDir::current().absoluteFilePath(args[0]))
Chris@172 54 .canonicalPath();
Chris@172 55
Chris@172 56 MainWindow mainWin(myDirPath);
jtkorhonen@0 57 mainWin.show();
Chris@145 58
Chris@145 59 if (args.size() == 2) {
Chris@145 60 QString path = args[1];
Chris@145 61 DEBUG << "Opening " << args[1] << endl;
Chris@145 62 if (QDir(path).exists()) {
Chris@145 63 path = QDir(path).canonicalPath();
Chris@145 64 mainWin.open(path);
Chris@145 65 }
Chris@145 66 }
Chris@145 67
jtkorhonen@0 68 return app.exec();
jtkorhonen@0 69 }