-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d0de7e
commit a803ec3
Showing
6 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// Copyright (c) 2024 Team Dissolve and contributors | ||
|
||
#include "base/messenger.h" | ||
#include "base/processPool.h" | ||
#include "gui/gui.h" | ||
#include "gui/types.h" | ||
#include "main/cli.h" | ||
#include "main/dissolve.h" | ||
#include "main/version.h" | ||
#include <QGuiApplication> | ||
#include <QQmlApplicationEngine> | ||
#include <QSurfaceFormat> | ||
#include <clocale> | ||
|
||
int main(int args, char **argv) | ||
{ | ||
// Instantiate main classes | ||
CoreData coreData; | ||
Dissolve dissolve(coreData); | ||
|
||
// Parse CLI options | ||
CLIOptions options; | ||
if (options.parse(args, argv, true) != CLIOptions::Success) | ||
return 1; | ||
|
||
// Initialise random seed | ||
srand(options.randomSeed().value_or((unsigned)time(nullptr))); | ||
|
||
QGuiApplication app(args, argv); | ||
|
||
QQmlApplicationEngine engine; | ||
const QUrl url(u"qrc:/main/qml/DissolveMain.qml"_qs); | ||
|
||
QObject::connect( | ||
&engine, | ||
&QQmlApplicationEngine::objectCreationFailed, | ||
&app, | ||
[]() { QCoreApplication::exit(-1); }, | ||
Qt::QueuedConnection | ||
); | ||
engine.load(url); | ||
|
||
Types::registerDissolveQmlTypes(); | ||
QCoreApplication::setOrganizationName("Team Dissolve"); | ||
QCoreApplication::setOrganizationDomain("www.projectdissolve.com"); | ||
QCoreApplication::setApplicationName("Dissolve-GUI-QML"); | ||
|
||
// Set native siblings attribute to prevent odd rendering artefacts on some systems | ||
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); | ||
|
||
// Ensure that the C locale is set, otherwise printf() and friends may not use dot for the radix point | ||
setlocale(LC_NUMERIC, "C"); | ||
QLocale::setDefault(QLocale::C); | ||
|
||
// Print GPL license information | ||
Messenger::print("Dissolve-GUI-QML {} version {}, Copyright (C) 2024 Team Dissolve and contributors.\n", Version::appType(), | ||
Version::info()); | ||
Messenger::print("Source repository: {}.\n", Version::repoUrl()); | ||
Messenger::print("Dissolve comes with ABSOLUTELY NO WARRANTY.\n"); | ||
Messenger::print("This is free software, and you are welcome to redistribute it under certain conditions.\n"); | ||
Messenger::print("For more details read the GPL at <http://www.gnu.org/copyleft/gpl.html>.\n"); | ||
|
||
// Flag to track our success in loading the input file and restart file | ||
auto loadSuccessful = true; | ||
|
||
// Set restart file frequency | ||
dissolve.setRestartFileFrequency(options.noRestartFile() ? 0 : options.restartFileFrequency()); | ||
|
||
// If an input file was specified, load it here | ||
if (options.inputFile()) | ||
// loadSuccessful = dissolveWindow.loadInputFile(options.inputFile().value()); | ||
|
||
// Load restart file if input file load was specified and loaded successfully | ||
if (options.inputFile() && loadSuccessful) | ||
{ | ||
if (options.ignoreRestartFile()) | ||
Messenger::print("Restart file (if it exists) will be ignored.\n"); | ||
else | ||
{ | ||
auto actualRestartFile{options.restartFilename().value_or(std::string(dissolve.restartFilename()))}; | ||
// loadSuccessful = dissolveWindow.loadRestartFile(actualRestartFile); | ||
} | ||
|
||
// Iterate before launching the GUI? | ||
if (loadSuccessful && options.nIterations() > 0) | ||
{ | ||
// Prepare for run | ||
if (!dissolve.prepare()) | ||
return 1; | ||
|
||
// Run main simulation | ||
dissolve.iterate(options.nIterations()); | ||
} | ||
} | ||
|
||
auto result = app.exec(); | ||
|
||
// Done. | ||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Target 'gui' | ||
add_library( | ||
gui-qml | ||
# Qt Resources | ||
resources.qrc | ||
) | ||
|
||
target_include_directories( | ||
gui-qml | ||
PRIVATE ${PROJECT_SOURCE_DIR}/src | ||
${PROJECT_BINARY_DIR}/src | ||
${Qt6Widgets_INCLUDE_DIRS} | ||
${FREETYPE_INCLUDE_DIRS} | ||
Qt6::OpenGL | ||
Qt6::OpenGLWidgets | ||
Qt6::Core | ||
) | ||
|
||
target_link_libraries( | ||
gui-qml | ||
PRIVATE models | ||
base | ||
Qt6::OpenGL | ||
Qt6::OpenGLWidgets | ||
Qt6::Quick | ||
Qt6::QuickControls2 | ||
Qt6::Core | ||
Qt6::Gui | ||
Qt6::Qml | ||
Qt6::QmlModels | ||
Qt6::QuickWidgets | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import QtQuick | ||
import QtQuick.Controls | ||
import QtQuick.Layouts | ||
|
||
ApplicationWindow { | ||
id: dissolveWindow | ||
visible: true | ||
width: 819 | ||
height: 743 | ||
title: "Dissolve" | ||
|
||
menuBar: MenuBar { | ||
id: mainMenu | ||
|
||
Menu { | ||
title: "&File" | ||
|
||
MenuItem { | ||
text: "&New" | ||
} | ||
|
||
MenuItem { | ||
text: "&Open..." | ||
} | ||
|
||
MenuItem { | ||
text: "Open R&ecent" | ||
} | ||
|
||
MenuItem { | ||
text: "Save" | ||
} | ||
|
||
MenuItem { | ||
text: "Save As..." | ||
} | ||
|
||
MenuItem { | ||
text: "Load Restart Point..." | ||
} | ||
|
||
MenuItem { | ||
text: "Save Restart Point..." | ||
} | ||
|
||
MenuItem { | ||
text: "Close" | ||
} | ||
|
||
MenuItem { | ||
text: "Quit" | ||
} | ||
} | ||
} | ||
|
||
TabBar { | ||
id: tabBar | ||
width: parent.width | ||
|
||
// DEFAULT TABS | ||
|
||
TabButton { | ||
id: messagesTab | ||
text: "Messages" | ||
width: implicitWidth | ||
} | ||
|
||
TabButton { | ||
id: forceFieldTab | ||
text: "Forcefield" | ||
width: implicitWidth | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<RCC> | ||
<qresource prefix="main"> | ||
<file>qml/DissolveMain.qml</file> | ||
</qresource> | ||
</RCC> |