File indexing completed on 2024-04-28 05:41:40
0001 /* 0002 This file is part of KCachegrind. 0003 0004 SPDX-FileCopyrightText: 2003-2016 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> 0005 0006 SPDX-License-Identifier: GPL-2.0-only 0007 */ 0008 0009 /* 0010 * QCachegrind startup 0011 */ 0012 0013 #include <QDir> 0014 #include <QApplication> 0015 0016 #include "qcgconfig.h" 0017 #include "config.h" 0018 #include "globalguiconfig.h" 0019 #include "qcgtoplevel.h" 0020 #include "tracedata.h" 0021 #include "loader.h" 0022 0023 int main( int argc, char ** argv ) 0024 { 0025 #ifdef Q_OS_MAC 0026 // Menu icons don't look right on macOS. 0027 QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); 0028 #endif 0029 0030 QApplication app(argc, argv); 0031 Loader::initLoaders(); 0032 0033 QCoreApplication::setOrganizationName(QStringLiteral("kde.org")); 0034 QCoreApplication::setApplicationName(QStringLiteral("QCachegrind")); 0035 ConfigStorage::setStorage(new QCGConfigStorage); 0036 // creates global config object of type GlobalGUIConfig 0037 //GlobalGUIConfig::config()->addDefaultTypes(); 0038 0039 QStringList list = app.arguments(); 0040 list.pop_front(); 0041 QCGTopLevel* t = new QCGTopLevel(); 0042 t->show(); 0043 if (list.isEmpty()) { 0044 // load files in current dir 0045 t->loadDelayed( QStringLiteral("."), false); 0046 } 0047 else { 0048 foreach(const QString& file, list) 0049 t->loadDelayed( QDir::fromNativeSeparators(file) ); 0050 } 0051 0052 int res = app.exec(); 0053 0054 // to make leak checking in valgrind happy... 0055 Loader::deleteLoaders(); 0056 ProfileContext::cleanup(); 0057 ConfigStorage::cleanup(); 0058 0059 return res; 0060 }