Changes to replace temp structs with openspace lib structs

This commit is contained in:
GPayne
2020-09-11 15:06:12 -06:00
parent 200a3d469b
commit 3a25ae79bc
20 changed files with 262 additions and 439 deletions

View File

@@ -169,5 +169,5 @@ if (OPENSPACE_NVTOOLS_ENABLED)
endif ()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher)
target_include_directories(OpenSpace SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher)
target_include_directories(OpenSpace SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ext/launcher/include)
target_link_libraries(OpenSpace profileGUIw)

View File

@@ -14,7 +14,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
target_include_directories(
OpenSpace PRIVATE
include
${Qt5_DIR}/../../../include
${Qt5_DIR}/../../../include/QtWidgets
${Qt5_DIR}/../../../include/QtCore
@@ -71,6 +70,7 @@ set(SOURCE_FILES
add_library(profileGUIw STATIC ${HEADER_FILES} ${SOURCE_FILES})
target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/include)
target_include_directories(profileGUIw PRIVATE include)
target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/ext/ghoul/include)
target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/ext/ghoul/ext/glm)
target_include_directories(profileGUIw PRIVATE ${OPENSPACE_BASE_DIR}/ext/ghoul/ext/cppformat/include)

View File

@@ -6,6 +6,7 @@
#include <QListWidgetItem>
#include "assettreemodel.h"
#include "filesystemaccess.h"
#include <openspace/scene/profile.h>
QT_BEGIN_NAMESPACE
namespace Ui {
@@ -13,11 +14,6 @@ class assets;
}
QT_END_NAMESPACE
struct Asset {
std::string path;
std::string name;
};
class assets : public QDialog
{
Q_OBJECT
@@ -27,7 +23,7 @@ public slots:
void parseSelections();
public:
explicit assets(std::vector<Asset>& imported, std::string& reportAssets,
explicit assets(std::vector<openspace::Profile::Asset>& imported, std::string& reportAssets,
QWidget *parent = nullptr);
~assets();
std::string createTextSummary();
@@ -43,7 +39,7 @@ private:
std::string dirname, std::string filename);
Ui::assets *ui;
QWidget* _parent;
std::vector<Asset>& _data;
std::vector<openspace::Profile::Asset>& _data;
assetTreeModel _assetTreeModel;
};

View File

@@ -11,294 +11,6 @@ class keybindings;
}
QT_END_NAMESPACE
enum class Key {
Unknown = -1,
Space = 32,
Apostrophe = 39,
Comma = 44,
Minus = 45,
Period = 46,
Slash = 47,
Num0 = 48,
Num1 = 49,
Num2 = 50,
Num3 = 51,
Num4 = 52,
Num5 = 53,
Num6 = 54,
Num7 = 55,
Num8 = 56,
Num9 = 57,
SemiColon = 59,
Equal = 61,
A = 65,
B = 66,
C = 67,
D = 68,
E = 69,
F = 70,
G = 71,
H = 72,
I = 73,
J = 74,
K = 75,
L = 76,
M = 77,
N = 78,
O = 79,
P = 80,
Q = 81,
R = 82,
S = 83,
T = 84,
U = 85,
V = 86,
W = 87,
X = 88,
Y = 89,
Z = 90,
LeftBracket = 91,
BackSlash = 92,
RightBracket = 93,
GraveAccent = 96,
World1 = 161,
World2 = 162,
Escape = 256,
Enter = 257,
Tab = 258,
BackSpace = 259,
Insert = 260,
Delete = 261,
Right = 262,
Left = 263,
Down = 264,
Up = 265,
PageUp = 266,
PageDown = 267,
Home = 268,
End = 269,
CapsLock = 280,
ScrollLock = 281,
NumLock = 282,
PrintScreen = 283,
Pause = 284,
F1 = 290,
F2 = 291,
F3 = 292,
F4 = 293,
F5 = 294,
F6 = 295,
F7 = 296,
F8 = 297,
F9 = 298,
F10 = 299,
F11 = 300,
F12 = 301,
F13 = 302,
F14 = 303,
F15 = 304,
F16 = 305,
F17 = 306,
F18 = 307,
F19 = 308,
F20 = 309,
F21 = 310,
F22 = 311,
F23 = 312,
F24 = 313,
F25 = 314,
Keypad0 = 320,
Keypad1 = 321,
Keypad2 = 322,
Keypad3 = 323,
Keypad4 = 324,
Keypad5 = 325,
Keypad6 = 326,
Keypad7 = 327,
Keypad8 = 328,
Keypad9 = 329,
KeypadDecimal = 330,
KeypadDivide = 331,
KeypadMultiply = 332,
KeypadSubtract = 333,
KeypadAdd = 334,
KeypadEnter = 335,
LeftShift = 340,
LeftControl = 341,
LeftAlt = 342,
LeftSuper = 343,
RightShift = 344,
RightControl = 345,
RightAlt = 346,
RightSuper = 347,
Menu = 348,
Last = Menu
};
static const std::map<int, std::string> keyNames = {
{32, "Space"},
{39, "'"},
{44, ","},
{45, "-"},
{46, "."},
{47, "/"},
{48, "0"},
{49, "1"},
{50, "2"},
{51, "3"},
{52, "4"},
{53, "5"},
{54, "6"},
{55, "7"},
{56, "8"},
{57, "9"},
{59, ";"},
{61, "="},
{65, "A"},
{66, "B"},
{67, "C"},
{68, "D"},
{69, "E"},
{70, "F"},
{71, "G"},
{72, "H"},
{73, "I"},
{74, "J"},
{75, "K"},
{76, "L"},
{77, "M"},
{78, "N"},
{79, "O"},
{80, "P"},
{81, "Q"},
{82, "R"},
{83, "S"},
{84, "T"},
{85, "U"},
{86, "V"},
{87, "W"},
{88, "X"},
{89, "Y"},
{90, "Z"},
{91, "["},
{92, "\\"},
{93, "]"},
{96, "`"},
{161, "World1"},
{162, "World2"},
{256, "Escape"},
{257, "Enter"},
{258, "Tab"},
{259, "BackSpace"},
{260, "Insert"},
{261, "Delete"},
{262, "Right"},
{263, "Left"},
{264, "Down"},
{265, "Up"},
{266, "PageUp"},
{267, "PageDown"},
{268, "Home"},
{269, "End"},
{280, "CapsLock"},
{281, "ScrollLock"},
{282, "NumLock"},
{283, "PrintScreen"},
{284, "Pause"},
{290, "F1"},
{291, "F2"},
{292, "F3"},
{293, "F4"},
{294, "F5"},
{295, "F6"},
{296, "F7"},
{297, "F8"},
{298, "F9"},
{299, "F10"},
{300, "F11"},
{301, "F12"},
{302, "F13"},
{303, "F14"},
{304, "F15"},
{305, "F16"},
{306, "F17"},
{307, "F18"},
{308, "F19"},
{309, "F20"},
{310, "F21"},
{311, "F22"},
{312, "F23"},
{313, "F24"},
{314, "F25"},
{320, "Keypad 0"},
{321, "Keypad 1"},
{322, "Keypad 2"},
{323, "Keypad 3"},
{324, "Keypad 4"},
{325, "Keypad 5"},
{326, "Keypad 6"},
{327, "Keypad 7"},
{328, "Keypad 8"},
{329, "Keypad 9"},
{330, "Keypad ."},
{331, "Keypad /"},
{332, "Keypad *"},
{333, "Keypad -"},
{334, "Keypad +"},
{335, "Keypad Enter"},
{340, "Left Shift"},
{341, "Left Control"},
{342, "Left Alt"},
{343, "Left Super"},
{344, "Right Shift"},
{345, "Right Control"},
{346, "Right Alt"},
{347, "Right Super"},
{348, "Menu"}
};
enum class KeyModifier : int {
NoModifier = 0,
Shift = 0x0001,
Control = 0x0002,
Alt = 0x0004,
Super = 0x0008,
Last = Super
};
static const std::map<int, std::string> keyModifierNames = {
{0, ""},
{0x0001, "Shift"},
{0x0002, "Control"},
{0x0004, "Alt"},
{0x0008, "Super"},
{0x0003, "Shift+Control"},
{0x0005, "Shift+Alt"},
{0x0009, "Shift+Super"},
{0x0006, "Control+Alt"},
{0x000A, "Control+Super"},
{0x000C, "Alt+Super"},
{0x0007, "Shift+Control+Alt"},
{0x000B, "Shift+Control+Super"},
{0x000D, "Shift+Alt+Super"},
{0x000E, "Control+Alt+Super"},
{0x000F, "Shift+Control+Alt+Super"}
};
struct KeyWithModifier {
Key key;
KeyModifier modifier;
};
struct Keybinding {
KeyWithModifier key;
std::string documentation;
std::string name;
std::string guiPath;
bool isLocal;
std::string script;
};
class keybindings : public QDialog
{
Q_OBJECT
@@ -313,14 +25,14 @@ public slots:
void parseSelections();
public:
explicit keybindings(std::vector<Keybinding>& imported, QWidget *parent = nullptr);
explicit keybindings(std::vector<openspace::Profile::Keybinding>& imported, QWidget *parent = nullptr);
~keybindings();
protected:
//void resizeEvent(QResizeEvent* event);
private:
QString createOneLineSummary(Keybinding k);
QString createOneLineSummary(openspace::Profile::Keybinding k);
void transitionFromEditMode();
void editBoxDisabled(bool disabled);
int indexInKeyMapping(std::vector<int>& mapVector, int keyInt);
@@ -331,8 +43,8 @@ private:
Ui::keybindings *ui;
QWidget* _parent;
std::vector<Keybinding>& _imported;
std::vector<Keybinding> _data;
std::vector<openspace::Profile::Keybinding>& _imported;
std::vector<openspace::Profile::Keybinding> _data;
std::vector<QListWidgetItem*> _keybindingsListItems;
std::vector<int> _mapModKeyComboBoxIndexToKeyValue;
std::vector<int> _mapKeyComboBoxIndexToKeyValue;

View File

@@ -2,6 +2,7 @@
#define LAUNCHERWINDOW_H
#include <QMainWindow>
#include <QString>
#include "profileedit.h"
#include "filesystemaccess.h"
@@ -19,7 +20,7 @@ public slots:
void simulateData();
public:
LauncherWindow(QWidget *parent = nullptr);
LauncherWindow(std::string basePath, QWidget *parent = nullptr);
~LauncherWindow();
void receiveAssets(std::vector<std::string> results);
@@ -43,18 +44,19 @@ private:
filesystemAccess _fileAccess_profiles;
filesystemAccess _fileAccess_winConfigs;
Meta _metaData;
std::vector<Module> _moduleData;
std::vector<Asset> _assetData;
openspace::Profile::Meta _metaData;
std::vector<openspace::Profile::Module> _moduleData;
std::vector<openspace::Profile::Asset> _assetData;
filesystemAccess _filesystemAccess;
std::string _reportAssetsInFilesystem;
std::vector<Property> _propsData;
std::vector<Keybinding> _keybindingsData;
std::vector<openspace::Profile::Property> _propsData;
std::vector<openspace::Profile::Keybinding> _keybindingsData;
DeltaTimes _deltaTimesData;
OSTime _timeData;
openspace::Profile::Time _timeData;
Camera _cameraData;
std::vector<std::string> _markNodesData;
std::string _addedScriptsData;
ProfileBlock _pData;
QString _basePath;
};
#endif // LAUNCHERWINDOW_H

View File

@@ -1,6 +1,7 @@
#ifndef META_H
#define META_H
#include <openspace/scene/profile.h>
#include <QDialog>
#include <QWidget>
@@ -10,15 +11,6 @@ class meta;
}
QT_END_NAMESPACE
struct Meta {
std::string name;
std::string version;
std::string description;
std::string author;
std::string url;
std::string license;
};
class meta : public QDialog
{
Q_OBJECT
@@ -27,13 +19,13 @@ public slots:
void save();
public:
explicit meta(Meta& imported, QWidget *parent = nullptr);
explicit meta(openspace::Profile::Meta& imported, QWidget *parent = nullptr);
~meta();
private:
Ui::meta *ui;
QWidget* _parent;
Meta& _imported;
openspace::Profile::Meta& _imported;
};
#endif // META_H

View File

@@ -11,12 +11,6 @@ class osmodules;
}
QT_END_NAMESPACE
struct Module {
std::string name;
std::string loadedInstruction;
std::string notLoadedInstruction;
};
class osmodules : public QDialog
{
Q_OBJECT
@@ -31,21 +25,21 @@ public slots:
void parseSelections();
public:
explicit osmodules(std::vector<Module>& imported, QWidget *parent = nullptr);
explicit osmodules(std::vector<openspace::Profile::Module>& imported, QWidget *parent = nullptr);
~osmodules();
protected:
//void resizeEvent(QResizeEvent* event);
private:
QString createOneLineSummary(Module m);
QString createOneLineSummary(openspace::Profile::Module m);
void transitionFromEditMode();
void editBoxDisabled(bool disabled);
Ui::osmodules *ui;
QWidget* _parent;
std::vector<Module>& _imported;
std::vector<Module> _data;
std::vector<openspace::Profile::Module>& _imported;
std::vector<openspace::Profile::Module> _data;
std::vector<QListWidgetItem*> _modulesListItems;
bool _editModeNewItem = false;
};

View File

@@ -10,16 +10,6 @@ class time;
}
QT_END_NAMESPACE
struct OSTime {
enum class Type {
Absolute,
Relative
};
Type type;
std::string time;
};
class ostime : public QDialog
{
Q_OBJECT
@@ -30,14 +20,14 @@ public slots:
void approved();
public:
explicit ostime(OSTime& imported, QWidget *parent = nullptr);
explicit ostime(openspace::Profile::Time& imported, QWidget *parent = nullptr);
~ostime();
private:
void enableFormatForAbsolute(bool enableAbs);
Ui::time *ui;
QWidget* _parent;
OSTime& _imported;
OSTime _data;
openspace::Profile::Time& _imported;
openspace::Profile::Time _data;
bool _initializedAsAbsolute = true;
};

View File

@@ -22,14 +22,14 @@ class ProfileEdit;
QT_END_NAMESPACE
struct ProfileBlock {
Meta& _metaData;
std::vector<Module>& _moduleData;
std::vector<Asset>& _assetData;
openspace::Profile::Meta& _metaData;
std::vector<openspace::Profile::Module>& _moduleData;
std::vector<openspace::Profile::Asset>& _assetData;
std::string& _reportAssetsInFilesystem;
std::vector<Property>& _propsData;
std::vector<Keybinding>& _keybindingsData;
std::vector<openspace::Profile::Property>& _propsData;
std::vector<openspace::Profile::Keybinding>& _keybindingsData;
DeltaTimes& _deltaTimesData;
OSTime& _timeData;
openspace::Profile::Time& _timeData;
Camera& _cameraData;
std::vector<std::string>& _markNodesData;
std::string& _addedScriptsData;

View File

@@ -11,16 +11,6 @@ class properties;
}
QT_END_NAMESPACE
struct Property {
enum class SetType {
SetPropertyValue,
SetPropertyValueSingle
};
SetType setType;
std::string name;
std::string value;
};
class properties : public QDialog
{
Q_OBJECT
@@ -35,22 +25,22 @@ public slots:
void parseSelections();
public:
explicit properties(std::vector<Property>& imported, QWidget *parent = nullptr);
explicit properties(std::vector<openspace::Profile::Property>& imported, QWidget *parent = nullptr);
~properties();
protected:
//void resizeEvent(QResizeEvent* event);
private:
QString createOneLineSummary(Property p);
QString createOneLineSummary(openspace::Profile::Property p);
void transitionFromEditMode();
void editBoxDisabled(bool disabled);
bool areRequiredFormsFilled();
Ui::properties *ui;
QWidget* _parent;
std::vector<Property>& _imported;
std::vector<Property> _data;
std::vector<openspace::Profile::Property>& _imported;
std::vector<openspace::Profile::Property> _data;
std::vector<QListWidgetItem*> _propListItems;
bool _editModeNewItem = false;
};

View File

@@ -5,8 +5,9 @@
#include <QScreen>
#include <sstream>
#include <string>
#include <openspace/scene/profile.h>
assets::assets(std::vector<Asset>& imported, std::string& reportAssets, QWidget *parent)
assets::assets(std::vector<openspace::Profile::Asset>& imported, std::string& reportAssets, QWidget *parent)
: QDialog(parent)
, ui(new Ui::assets)
, _data(imported)
@@ -32,7 +33,7 @@ assets::assets(std::vector<Asset>& imported, std::string& reportAssets, QWidget
}
void assets::compareFilesystemWithProfileAssets() {
for (Asset a : _data) {
for (openspace::Profile::Asset a : _data) {
findPathMatch(a.path, a.name);
}
}
@@ -132,7 +133,7 @@ std::string assets::createTextSummary() {
void assets::parseSelections() {
_data.clear();
for (std::string selected : _assetTreeModel.selectedAssets()) {
Asset a;
openspace::Profile::Asset a;
size_t slash = selected.find_last_of('/');
if (slash == std::string::npos) {
a.path = "";

View File

@@ -1,3 +1,4 @@
#include <openspace/scene/profile.h>
#include "camera.h"
#include "./ui_camera.h"

View File

@@ -1,9 +1,11 @@
#include <openspace/scene/profile.h>
#include <openspace/util/keys.h>
#include "keybindings.h"
#include "./ui_keybindings.h"
#include <qevent.h>
#include <algorithm>
keybindings::keybindings(std::vector<Keybinding>& imported, QWidget *parent)
keybindings::keybindings(std::vector<openspace::Profile::Keybinding>& imported, QWidget *parent)
: QDialog(parent)
, ui(new Ui::keybindings)
, _imported(imported)
@@ -18,26 +20,16 @@ keybindings::keybindings(std::vector<Keybinding>& imported, QWidget *parent)
QStringList comboModKeysStringList;
int modIdx = 0;
// for (mit = keyModifierNames.begin(); mit < keyModifierNames.end(); mit++) {
for (auto const& m : keyModifierNames) {
for (auto const& m : openspace::KeyModifierNames) {
comboModKeysStringList += QString(m.second.c_str());
_mapModKeyComboBoxIndexToKeyValue.push_back(modIdx++);
/*for (int i = static_cast<int>(KeyModifier::NoModifier);
i <= static_cast<int>(KeyModifier::Super);
++i)
{
if (keyModifierNames.find(i) != keyModifierNames.end()) {
comboModKeysStringList += QString(keyModifierNames.at(i).c_str());
_mapModKeyComboBoxIndexToKeyValue.push_back(i);
}*/
}
ui->combo_keyMod->addItems(comboModKeysStringList);
QStringList comboKeysStringList;
for (int i = 0; i < static_cast<int>(Key::Last); ++i) {
if (keyNames.find(i) != keyNames.end()) {
comboKeysStringList += QString(keyNames.at(i).c_str());
for (int i = 0; i < static_cast<int>(openspace::Key::Last); ++i) {
if (openspace::KeyNames.find(i) != openspace::KeyNames.end()) {
comboKeysStringList += QString(openspace::KeyNames.at(i).c_str());
//Create map to relate key combo box to actual integer value defined in Key
_mapKeyComboBoxIndexToKeyValue.push_back(i);
}
@@ -54,16 +46,16 @@ keybindings::keybindings(std::vector<Keybinding>& imported, QWidget *parent)
transitionFromEditMode();
}
QString keybindings::createOneLineSummary(Keybinding k) {
QString keybindings::createOneLineSummary(openspace::Profile::Keybinding k) {
std::string summary;
int keymod = static_cast<int>(k.key.modifier);
if (keymod != static_cast<int>(KeyModifier::NoModifier)) {
summary += keyModifierNames.at(keymod) + "+";
if (keymod != static_cast<int>(openspace::KeyModifier::NoModifier)) {
summary += openspace::KeyModifierNames.at(keymod) + "+";
}
int keyname = static_cast<int>(k.key.key);
summary += keyNames.at(keyname) + " : ";
summary += openspace::KeyNames.at(keyname) + " : ";
summary += truncateString(k.name) + " (";
summary += truncateString(k.documentation) + ") @ ";
summary += truncateString(k.guiPath) + " ";
@@ -103,7 +95,7 @@ void keybindings::listItemSelected(void) {
QListWidgetItem *item = ui->list->currentItem();
int index = ui->list->row(item);
Keybinding& k = _data[index];
openspace::Profile::Keybinding& k = _data[index];
ui->combo_keyMod->setCurrentIndex(
indexInKeyMapping(_mapModKeyComboBoxIndexToKeyValue,
static_cast<int>(k.key.modifier)));
@@ -133,7 +125,7 @@ int keybindings::indexInKeyMapping(std::vector<int>& mapVector, int keyInt) {
void keybindings::listItemAdded(void) {
//Add new line at bottom of props list
_data.push_back({
{Key::Unknown, KeyModifier::NoModifier},
{openspace::Key::Unknown, openspace::KeyModifier::NoModifier},
"",
"",
"",
@@ -168,9 +160,9 @@ void keybindings::listItemSave(void) {
int index = ui->list->row(item);
int keyModIdx = _mapModKeyComboBoxIndexToKeyValue.at(ui->combo_keyMod->currentIndex());
_data[index].key.modifier = static_cast<KeyModifier>(keyModIdx);
_data[index].key.modifier = static_cast<openspace::KeyModifier>(keyModIdx);
int keyIdx = _mapKeyComboBoxIndexToKeyValue.at(ui->combo_key->currentIndex());
_data[index].key.key = static_cast<Key>(keyIdx);
_data[index].key.key = static_cast<openspace::Key>(keyIdx);
_data[index].name = ui->line_name->text().toUtf8().constData();
_data[index].documentation = ui->line_documentation->text().toUtf8().constData();
_data[index].guiPath = ui->line_guiPath->text().toUtf8().constData();
@@ -213,7 +205,7 @@ void keybindings::listItemCancelSave(void) {
if (_editModeNewItem) {
if(_data.back().name.length() == 0 ||
_data.back().script.length() == 0 ||
_data.back().key.key == Key::Unknown)
_data.back().key.key == openspace::Key::Unknown)
{
listItemRemove();
}

View File

@@ -1,3 +1,4 @@
#include <openspace/scene/profile.h>
#include "launcherwindow.h"
#include "profileedit.h"
#include "./ui_launcherwindow.h"
@@ -6,13 +7,14 @@
#include <sstream>
LauncherWindow::LauncherWindow(QWidget *parent)
LauncherWindow::LauncherWindow(std::string basePath, QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::LauncherWindow)
, _fileAccess_profiles(".profile", {"./"}, true, false)
, _fileAccess_winConfigs(".xml", {"./"}, true, false)
, _filesystemAccess(".asset", {"scene", "global", "customization", "examples"},
true, true)
, _basePath(QString::fromUtf8(basePath.c_str()))
, _pData({_metaData,
_moduleData,
_assetData,
@@ -26,7 +28,8 @@ LauncherWindow::LauncherWindow(QWidget *parent)
_addedScriptsData})
{
ui->setupUi(this);
QPixmap pix("../profileGUI/openspace-horizontal-color-transparent.png");
QString logoPath = _basePath + "/data/openspace-horiz-logo.png";
QPixmap pix(logoPath);
ui->logolabel->setPixmap(pix.scaled(400, 120, Qt::KeepAspectRatio));
connect(ui->newButton, SIGNAL(released()), this, SLOT(openWindow_new()));
connect(ui->editButton, SIGNAL(released()), this, SLOT(openWindow_edit()));
@@ -37,7 +40,7 @@ LauncherWindow::LauncherWindow(QWidget *parent)
void LauncherWindow::populateProfilesList() {
std::string reportProfiles = _fileAccess_profiles.useQtFileSystemModelToTraverseDir(
"/home/gene/Desktop/OpenSpace/data/profiles");
_basePath + "/data/profiles");
std::stringstream instream(reportProfiles);
std::string iline;
QStringList profilesListLine;
@@ -49,7 +52,7 @@ void LauncherWindow::populateProfilesList() {
void LauncherWindow::populateWindowConfigsList() {
std::string reportConfigs = _fileAccess_winConfigs.useQtFileSystemModelToTraverseDir(
"/home/gene/Desktop/OpenSpace/config");
_basePath + "/config");
std::stringstream instream(reportConfigs);
std::string iline;
QStringList windowConfigsListLine;
@@ -66,7 +69,11 @@ void LauncherWindow::openWindow_new() {
}
void LauncherWindow::openWindow_edit() {
//simulateData();
//std::string editProfilePath = _basePath.toUtf8().constData();
//editProfilePath += "/data/profiles/";
//editProfilePath += ui->comboBoxProfiles->currentText().toUtf8().constData();
//editProfilePath += ".profile";
//myEditorWindow = new editorwindow(_basePath + "/data/assets", editProfilePath);
myEditorWindow = new ProfileEdit(_pData);
int selectedProfileIdx = ui->comboBoxProfiles->currentIndex();
@@ -172,62 +179,62 @@ void LauncherWindow::initialize_assets() {
void LauncherWindow::initialize_properties() {
_propsData = {
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance",
"20.0"
},
{
Property::SetType::SetPropertyValue,
openspace::Profile::Property::SetType::SetPropertyValue,
"Scene.Pluto.Renderable.Enabled",
"false"
},
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"Scene.Charon.Renderable.Enabled",
"false"
},
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"Scene.PlutoBarycenterTrail.Renderable.Enabled",
"false"
},
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance",
"20.0"
},
{
Property::SetType::SetPropertyValue,
openspace::Profile::Property::SetType::SetPropertyValue,
"Scene.Pluto.Renderable.Enabled",
"false"
},
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"Scene.Styx.Renderable.Enabled",
"false"
},
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"Scene.PlutoBarycenterTrail.Renderable.Enabled",
"false"
},
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"NavigationHandler.OrbitalNavigator.FollowAnchorNodeRotationDistance",
"20.0"
},
{
Property::SetType::SetPropertyValue,
openspace::Profile::Property::SetType::SetPropertyValue,
"Scene.Pluto.Renderable.Enabled",
"false"
},
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"Scene.StyxRenderableTrail.Renderable.Enabled",
"false"
},
{
Property::SetType::SetPropertyValueSingle,
openspace::Profile::Property::SetType::SetPropertyValueSingle,
"Scene.PlutoBarycenterTrail.Renderable.Enabled",
"false"
},
@@ -237,7 +244,7 @@ void LauncherWindow::initialize_properties() {
void LauncherWindow::initialize_keybindings() {
_keybindingsData = {
{
{Key::Equal, KeyModifier::Control},
{openspace::Key::Equal, openspace::KeyModifier::Control},
"Documentation for ctrl+=",
"Name for the keybinding",
"/Path/to/keys",
@@ -245,7 +252,7 @@ void LauncherWindow::initialize_keybindings() {
"openspace.keybindings.local.variable.1"
},
{
{Key::KeypadAdd, KeyModifier::Shift},
{openspace::Key::KeypadAdd, openspace::KeyModifier::Shift},
"Documentation for shift++",
"Name for the keybinding",
"/Path/to/keys",
@@ -253,7 +260,7 @@ void LauncherWindow::initialize_keybindings() {
"openspace.keybindings.local.variable.2"
},
{
{Key::Keypad3, KeyModifier::NoModifier},
{openspace::Key::Keypad3, openspace::KeyModifier::NoModifier},
"Documentation for '3'",
"Name for the keybinding",
"/Path/to/keys",
@@ -272,7 +279,7 @@ void LauncherWindow::initialize_deltaTimes() {
}
void LauncherWindow::initialize_time() {
_timeData.type = OSTime::Type::Absolute;
_timeData.type = openspace::Profile::Time::Type::Absolute;
_timeData.time = "2011-04-17T21:23:59";
}

View File

@@ -1,7 +1,8 @@
#include <openspace/scene/profile.h>
#include "meta.h"
#include "./ui_meta.h"
meta::meta(Meta& imported, QWidget *parent)
meta::meta(openspace::Profile::Meta& imported, QWidget *parent)
: QDialog(parent)
, ui(new Ui::meta)
, _imported(imported)

View File

@@ -1,8 +1,9 @@
#include <openspace/scene/profile.h>
#include "osmodules.h"
#include "./ui_osmodules.h"
#include <qevent.h>
osmodules::osmodules(std::vector<Module>& imported, QWidget *parent)
osmodules::osmodules(std::vector<openspace::Profile::Module>& imported, QWidget *parent)
: QDialog(parent)
, ui(new Ui::osmodules)
, _imported(imported)
@@ -25,7 +26,7 @@ osmodules::osmodules(std::vector<Module>& imported, QWidget *parent)
transitionFromEditMode();
}
QString osmodules::createOneLineSummary(Module m) {
QString osmodules::createOneLineSummary(openspace::Profile::Module m) {
QString summary = QString(m.name.c_str());
bool hasCommandForLoaded = (m.loadedInstruction.length() > 0);
bool hasCommandForNotLoaded = (m.notLoadedInstruction.length() > 0);
@@ -49,7 +50,7 @@ void osmodules::listItemSelected(void) {
QListWidgetItem *item = ui->list->currentItem();
int index = ui->list->row(item);
Module& m = _data[index];
openspace::Profile::Module& m = _data[index];
ui->line_module->setText(QString(m.name.c_str()));
ui->line_loaded->setText(QString(m.loadedInstruction.c_str()));
ui->line_notLoaded->setText(QString(m.notLoadedInstruction.c_str()));

View File

@@ -1,8 +1,9 @@
#include <openspace/scene/profile.h>
#include "ostime.h"
#include "./ui_ostime.h"
#include <algorithm>
ostime::ostime(OSTime& imported, QWidget *parent)
ostime::ostime(openspace::Profile::Time& imported, QWidget *parent)
: QDialog(parent)
, ui(new Ui::time)
, _imported(imported)
@@ -12,7 +13,7 @@ ostime::ostime(OSTime& imported, QWidget *parent)
QStringList types { "Absolute", "Relative" };
ui->combo_type->addItems(types);
_initializedAsAbsolute = (_data.type == OSTime::Type::Absolute);
_initializedAsAbsolute = (_data.type == openspace::Profile::Time::Type::Absolute);
enableAccordingToType(static_cast<int>(_data.type));
@@ -23,11 +24,11 @@ ostime::ostime(OSTime& imported, QWidget *parent)
}
void ostime::enableAccordingToType(int idx) {
OSTime::Type comboIdx = static_cast<OSTime::Type>(idx);
bool setFormatForAbsolute = (comboIdx == OSTime::Type::Absolute);
openspace::Profile::Time::Type comboIdx = static_cast<openspace::Profile::Time::Type>(idx);
bool setFormatForAbsolute = (comboIdx == openspace::Profile::Time::Type::Absolute);
enableFormatForAbsolute(setFormatForAbsolute);
ui->combo_type->setCurrentIndex(idx);
if (comboIdx == OSTime::Type::Relative) {
if (comboIdx == openspace::Profile::Time::Type::Relative) {
ui->label_relative->setText("<font color='black'>Relative Time:</font>");
if (_initializedAsAbsolute) {
ui->line_relative->setText("");
@@ -64,16 +65,16 @@ void ostime::cancel() {
}
void ostime::approved() {
if (ui->combo_type->currentIndex() == static_cast<int>(OSTime::Type::Relative)) {
if (ui->combo_type->currentIndex() == static_cast<int>(openspace::Profile::Time::Type::Relative)) {
if (ui->line_relative->text().length() == 0) {
ui->label_relative->setText("<font color='red'>Relative Time:</font>");
return;
}
_imported.type = OSTime::Type::Relative;
_imported.type = openspace::Profile::Time::Type::Relative;
_imported.time = ui->line_relative->text().toUtf8().constData();
}
else {
_imported.type = OSTime::Type::Absolute;
_imported.type = openspace::Profile::Time::Type::Absolute;
QString res = ui->dateEdit->date().toString("yyyy-MM-dd") + "T" + ui->timeEdit->time().toString();
_imported.time = res.toUtf8().constData();
}

View File

@@ -1,3 +1,4 @@
#include <openspace/scene/profile.h>
#include "profileedit.h"
#include "./ui_profileedit.h"
#include "filesystemaccess.h"
@@ -81,7 +82,7 @@ void ProfileEdit::openModules() {
QString ProfileEdit::summarizeText_modules() {
QString results = QString("<Configured with %1 modules>\n").arg(_pData._moduleData.size());
for (Module m : _pData._moduleData) {
for (openspace::Profile::Module m : _pData._moduleData) {
results += " " + QString(m.name.c_str());
if (m.loadedInstruction.size() > 0 && m.notLoadedInstruction.size() > 0) {
results += " (has commands for both loaded & non-loaded conditions)";
@@ -105,7 +106,7 @@ void ProfileEdit::openProperties() {
QString ProfileEdit::summarizeText_properties() {
QString results = QString("<Configured with %1 properties>\n").arg(_pData._propsData.size());
for (Property p : _pData._propsData) {
for (openspace::Profile::Property p : _pData._propsData) {
results += " " + QString(p.name.c_str()) + " = ";
results += QString(p.value.c_str()) + "\n";
}
@@ -121,13 +122,13 @@ void ProfileEdit::openKeybindings() {
QString ProfileEdit::summarizeText_keybindings() {
QString results =
QString("<Configured with %1 keybindings>\n").arg(_pData._keybindingsData.size());
for (Keybinding k : _pData._keybindingsData) {
for (openspace::Profile::Keybinding k : _pData._keybindingsData) {
results += " " + QString(k.name.c_str()) + " (";
int keymod = static_cast<int>(k.key.modifier);
if (keymod != static_cast<int>(KeyModifier::NoModifier)) {
results += QString(keyModifierNames.at(keymod).c_str()) + "+";
if (keymod != static_cast<int>(openspace::KeyModifier::NoModifier)) {
results += QString(openspace::KeyModifierNames.at(keymod).c_str()) + "+";
}
results += QString(keyNames.at(static_cast<int>(k.key.key)).c_str());
results += QString(openspace::KeyNames.at(static_cast<int>(k.key.key)).c_str());
results += ")\n";
}
return results;
@@ -141,7 +142,7 @@ void ProfileEdit::openAssets() {
QString ProfileEdit::summarizeText_assets() {
QString results = QString("<Configured with %1 assets>\n").arg(_pData._assetData.size());
for (Asset a : _pData._assetData) {
for (openspace::Profile::Asset a : _pData._assetData) {
results += " " + QString(a.path.c_str()) + "/";
results += QString(a.name.c_str()) + "\n";
}
@@ -156,10 +157,10 @@ void ProfileEdit::openTime() {
QString ProfileEdit::summarizeText_time() {
QString results;
if (_pData._timeData.type == OSTime::Type::Absolute) {
if (_pData._timeData.type == openspace::Profile::Time::Type::Absolute) {
results = "Absolute time: ";
}
else if (_pData._timeData.type == OSTime::Type::Relative) {
else if (_pData._timeData.type == openspace::Profile::Time::Type::Relative) {
results = "Relative time: ";
}
results += QString(_pData._timeData.time.c_str());

View File

@@ -1,8 +1,9 @@
#include <openspace/scene/profile.h>
#include "properties.h"
#include "./ui_properties.h"
#include <qevent.h>
properties::properties(std::vector<Property>& imported, QWidget *parent)
properties::properties(std::vector<openspace::Profile::Property>& imported, QWidget *parent)
: QDialog(parent)
, ui(new Ui::properties)
, _imported(imported)
@@ -27,12 +28,12 @@ properties::properties(std::vector<Property>& imported, QWidget *parent)
transitionFromEditMode();
}
QString properties::createOneLineSummary(Property p) {
QString properties::createOneLineSummary(openspace::Profile::Property p) {
QString summary = QString(p.name.c_str());
summary += " = ";
summary += QString(p.value.c_str());
summary += " (SetPropertyValue";
if (p.setType == Property::SetType::SetPropertyValueSingle) {
if (p.setType == openspace::Profile::Property::SetType::SetPropertyValueSingle) {
summary += "Single";
}
summary += ")";
@@ -43,8 +44,8 @@ void properties::listItemSelected(void) {
QListWidgetItem *item = ui->list->currentItem();
int index = ui->list->row(item);
Property& p = _data[index];
if (p.setType == Property::SetType::SetPropertyValue) {
openspace::Profile::Property& p = _data[index];
if (p.setType == openspace::Profile::Property::SetType::SetPropertyValue) {
ui->combo_command->setCurrentIndex(0);
}
else {
@@ -57,7 +58,7 @@ void properties::listItemSelected(void) {
void properties::listItemAdded(void) {
//Add new line at bottom of props list
_data.push_back({Property::SetType::SetPropertyValue, "", ""});
_data.push_back({openspace::Profile::Property::SetType::SetPropertyValue, "", ""});
_propListItems.push_back(new QListWidgetItem(" (Enter details below and click 'Save')"));
ui->list->addItem(_propListItems.back());
@@ -80,10 +81,10 @@ void properties::listItemSave(void) {
int index = ui->list->row(item);
if (ui->combo_command->currentIndex() == 0) {
_data[index].setType = Property::SetType::SetPropertyValue;
_data[index].setType = openspace::Profile::Property::SetType::SetPropertyValue;
}
else {
_data[index].setType = Property::SetType::SetPropertyValueSingle;
_data[index].setType = openspace::Profile::Property::SetType::SetPropertyValueSingle;
}
_data[index].name = ui->line_property->text().toUtf8().constData();
_data[index].value = ui->line_value->text().toUtf8().constData();

View File

@@ -82,6 +82,25 @@ enum class KeyModifier : int {
Super = 0x0008
};
static const std::map<int, std::string> KeyModifierNames = {
{0, ""},
{0x0001, "Shift"},
{0x0002, "Control"},
{0x0004, "Alt"},
{0x0008, "Super"},
{0x0003, "Shift+Control"},
{0x0005, "Shift+Alt"},
{0x0009, "Shift+Super"},
{0x0006, "Control+Alt"},
{0x000A, "Control+Super"},
{0x000C, "Alt+Super"},
{0x0007, "Shift+Control+Alt"},
{0x000B, "Shift+Control+Super"},
{0x000D, "Shift+Alt+Super"},
{0x000E, "Control+Alt+Super"},
{0x000F, "Shift+Control+Alt+Super"}
};
bool hasKeyModifier(KeyModifier lhs, KeyModifier rhs);
KeyModifier operator|(KeyModifier lhs, KeyModifier rhs);
@@ -211,6 +230,128 @@ enum class Key {
Last = Menu
};
static const std::map<int, std::string> KeyNames = {
{32, "Space"},
{39, "'"},
{44, ","},
{45, "-"},
{46, "."},
{47, "/"},
{48, "0"},
{49, "1"},
{50, "2"},
{51, "3"},
{52, "4"},
{53, "5"},
{54, "6"},
{55, "7"},
{56, "8"},
{57, "9"},
{59, ";"},
{61, "="},
{65, "A"},
{66, "B"},
{67, "C"},
{68, "D"},
{69, "E"},
{70, "F"},
{71, "G"},
{72, "H"},
{73, "I"},
{74, "J"},
{75, "K"},
{76, "L"},
{77, "M"},
{78, "N"},
{79, "O"},
{80, "P"},
{81, "Q"},
{82, "R"},
{83, "S"},
{84, "T"},
{85, "U"},
{86, "V"},
{87, "W"},
{88, "X"},
{89, "Y"},
{90, "Z"},
{91, "["},
{92, "\\"},
{93, "]"},
{96, "`"},
{161, "World1"},
{162, "World2"},
{256, "Escape"},
{257, "Enter"},
{258, "Tab"},
{259, "BackSpace"},
{260, "Insert"},
{261, "Delete"},
{262, "Right"},
{263, "Left"},
{264, "Down"},
{265, "Up"},
{266, "PageUp"},
{267, "PageDown"},
{268, "Home"},
{269, "End"},
{280, "CapsLock"},
{281, "ScrollLock"},
{282, "NumLock"},
{283, "PrintScreen"},
{284, "Pause"},
{290, "F1"},
{291, "F2"},
{292, "F3"},
{293, "F4"},
{294, "F5"},
{295, "F6"},
{296, "F7"},
{297, "F8"},
{298, "F9"},
{299, "F10"},
{300, "F11"},
{301, "F12"},
{302, "F13"},
{303, "F14"},
{304, "F15"},
{305, "F16"},
{306, "F17"},
{307, "F18"},
{308, "F19"},
{309, "F20"},
{310, "F21"},
{311, "F22"},
{312, "F23"},
{313, "F24"},
{314, "F25"},
{320, "Keypad 0"},
{321, "Keypad 1"},
{322, "Keypad 2"},
{323, "Keypad 3"},
{324, "Keypad 4"},
{325, "Keypad 5"},
{326, "Keypad 6"},
{327, "Keypad 7"},
{328, "Keypad 8"},
{329, "Keypad 9"},
{330, "Keypad ."},
{331, "Keypad /"},
{332, "Keypad *"},
{333, "Keypad -"},
{334, "Keypad +"},
{335, "Keypad Enter"},
{340, "Left Shift"},
{341, "Left Control"},
{342, "Left Alt"},
{343, "Left Super"},
{344, "Right Shift"},
{345, "Right Control"},
{346, "Right Alt"},
{347, "Right Super"},
{348, "Menu"}
};
struct KeyWithModifier {
Key key;
KeyModifier modifier;