-
Notifications
You must be signed in to change notification settings - Fork 3
/
Main.cpp
66 lines (54 loc) · 2.41 KB
/
Main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
////////////////////////////////////////////////////////////////////////
// Copyright 2009-2018 NTESS. Under the terms
// of Contract DE-NA0003525 with NTESS, the U.S.
// Government retains certain rights in this software.
//
// Copyright (c) 2009-2018, NTESS
// All rights reserved.
//
// Portions are copyright of other developers:
// See the file CONTRIBUTORS.TXT in the top level directory
// the distribution for more information.
//
// This file is part of the SST software package. For license
// information, see the LICENSE file in the top level directory of the
// distribution.
////////////////////////////////////////////////////////////////////////
#include "MainWindow.h"
////////////////////////////////////////////////////////////
int main(int argc, char *argv[])
{
QSharedMemory SharedMemory;
// Create the Application
QApplication app(argc, argv);
// See if this is the first instance of the app, if not, then exit
SharedMemory.setKey(COREAPP_SINGLEINSTANCEKEY);
if (SharedMemory.attach()) {
return -1; // If we attach, prev instance of app has already created memory
}
if (!SharedMemory.create(1)) {
return -1; // We cannot create memory
}
// Build the Main window and show it
MainWindow mainwin;
mainwin.show();
// Set the Core Application data - Used by QSettings
// This is std formatting of the persistent data
QCoreApplication::setApplicationName(COREAPP_APPNAME);
QCoreApplication::setApplicationVersion(COREAPP_VERSION);
QCoreApplication::setOrganizationName(COREAPP_ORGNAME);
QCoreApplication::setOrganizationDomain(COREAPP_DOMAINNAME);
// Set the Application Icon
app.setWindowIcon(QIcon(":/images/Sandia_Icon.png"));
// Execute the Application (Run the Message Pump)
return app.exec();
}
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
// FOR FUTURE IMPLEMENTATION - A MORE SOPHISTICATED INSTANCE HANDLER
// THAT ALLOWS FOR DETECTING CHANGES TO THE SAME FILE ON THEIR VIEWS
// See: http://www.qtcentre.org/wiki/index.php?title=SingleApplication
// and: http://qt-project.org/forums/viewthread/22994
////////////////////////////////////////////////////////////////////////