Chris@57: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@57: Chris@57: /* Chris@57: EasyMercurial Chris@57: Chris@57: Based on HgExplorer by Jari Korhonen Chris@57: Copyright (c) 2010 Jari Korhonen Chris@644: Copyright (c) 2013 Chris Cannam Chris@644: Copyright (c) 2013 Queen Mary, University of London Chris@57: Chris@57: This program is free software; you can redistribute it and/or Chris@57: modify it under the terms of the GNU General Public License as Chris@57: published by the Free Software Foundation; either version 2 of the Chris@57: License, or (at your option) any later version. See the file Chris@57: COPYING included with this distribution for more information. Chris@57: */ jtkorhonen@0: jtkorhonen@0: #include "mainwindow.h" Chris@78: #include "common.h" Chris@78: #include "debug.h" Chris@643: #include "version.h" jtkorhonen@0: Chris@145: #include Chris@155: #include Chris@145: #include Chris@145: Chris@643: using std::cout; Chris@643: using std::endl; Chris@643: jtkorhonen@0: int main(int argc, char *argv[]) jtkorhonen@0: { Chris@643: if (argc == 2 && Chris@643: (!strcmp(argv[1], "-v") || Chris@643: !strcmp(argv[1], "--version"))) { Chris@643: cout << "EasyMercurial v" << EASYHG_VERSION << "\n" Chris@643: << "Copyright (c) 2010 Jari Korhonen\n" Chris@644: << "Copyright (c) 2013 Chris Cannam\n" Chris@682: << "Copyright (c) 2013-2018 Queen Mary, University of London\n" Chris@643: << "This program is free software; you can redistribute it and/or\n" Chris@643: << "modify it under the terms of the GNU General Public License as\n" Chris@643: << "published by the Free Software Foundation; either version 2 of the\n" Chris@643: << "License, or (at your option) any later version. See the file\n" Chris@643: << "COPYING included with this distribution for more information." Chris@643: << endl; Chris@643: return 0; Chris@643: } Chris@643: Chris@256: QApplication app(argc, argv); Chris@256: Chris@61: QApplication::setOrganizationName("easymercurial"); Chris@61: QApplication::setOrganizationDomain("easymercurial.org"); Chris@61: QApplication::setApplicationName(QApplication::tr("EasyMercurial")); jtkorhonen@0: Chris@462: #ifdef Q_OS_MAC Chris@462: // Mac doesn't align menu labels when icons are shown: result is messy Chris@462: app.setAttribute(Qt::AA_DontShowIconsInMenus); Chris@462: #endif Chris@462: Chris@78: // Lose our controlling terminal (so we can provide a new pty to Chris@78: // capture password requests) Chris@78: loseControllingTerminal(); Chris@78: Chris@105: installSignalHandlers(); Chris@105: Chris@155: QTranslator translator; Chris@155: QString language = QLocale::system().name(); Chris@493: if (language == "C") language = "en"; Chris@155: QString trname = QString("easyhg_%1").arg(language); Chris@155: translator.load(trname, ":"); Chris@155: app.installTranslator(&translator); Chris@155: Chris@145: QStringList args = app.arguments(); Chris@172: Chris@172: QString myDirPath = QFileInfo(QDir::current().absoluteFilePath(args[0])) Chris@172: .canonicalPath(); Chris@172: Chris@172: MainWindow mainWin(myDirPath); jtkorhonen@0: mainWin.show(); Chris@145: Chris@145: if (args.size() == 2) { Chris@145: QString path = args[1]; Chris@145: DEBUG << "Opening " << args[1] << endl; Chris@145: if (QDir(path).exists()) { Chris@145: path = QDir(path).canonicalPath(); Chris@145: mainWin.open(path); Chris@145: } Chris@145: } Chris@145: jtkorhonen@0: return app.exec(); jtkorhonen@0: }