Rename dialog files

This commit is contained in:
Alexander Bock
2020-10-12 19:14:01 +02:00
parent 39362daf78
commit 3a5f837290
30 changed files with 290 additions and 250 deletions

View File

@@ -25,39 +25,39 @@
include(${OPENSPACE_CMAKE_EXT_DIR}/set_openspace_compile_settings.cmake)
set(HEADER_FILES
include/additionalscripts.h
include/assets.h
include/assettreeitem.h
include/assettreemodel.h
include/camera.h
include/deltatimes.h
include/filesystemaccess.h
include/keybindings.h
include/launcherwindow.h
include/marknodes.h
include/meta.h
include/modules.h
include/timedialog.h
include/profileedit.h
include/properties.h
include/profile/additionalscriptsdialog.h
include/profile/assetsdialog.h
include/profile/assettreeitem.h
include/profile/assettreemodel.h
include/profile/cameradialog.h
include/profile/deltatimesdialog.h
include/profile/keybindingsdialog.h
include/profile/marknodesdialog.h
include/profile/metadialog.h
include/profile/modulesdialog.h
include/profile/timedialog.h
include/profile/profileedit.h
include/profile/propertiesdialog.h
)
set(SOURCE_FILES
src/additionalscripts.cpp
src/assets.cpp
src/assettreeitem.cpp
src/assettreemodel.cpp
src/camera.cpp
src/deltatimes.cpp
src/filesystemaccess.cpp
src/keybindings.cpp
src/launcherwindow.cpp
src/marknodes.cpp
src/meta.cpp
src/modules.cpp
src/timedialog.cpp
src/profileedit.cpp
src/properties.cpp
src/filesystemaccess.cpp
src/profile/additionalscriptsdialog.cpp
src/profile/assetsdialog.cpp
src/profile/assettreeitem.cpp
src/profile/assettreemodel.cpp
src/profile/cameradialog.cpp
src/profile/deltatimesdialog.cpp
src/profile/keybindingsdialog.cpp
src/profile/marknodesdialog.cpp
src/profile/metadialog.cpp
src/profile/modulesdialog.cpp
src/profile/timedialog.cpp
src/profile/profileedit.cpp
src/profile/propertiesdialog.cpp
)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
@@ -65,19 +65,19 @@ find_package(Qt5 COMPONENTS Widgets REQUIRED)
set(MOC_FILES "")
qt5_wrap_cpp(
MOC_FILES
include/additionalscripts.h
include/assets.h
include/assettreemodel.h
include/camera.h
include/deltatimes.h
include/keybindings.h
include/launcherwindow.h
include/marknodes.h
include/meta.h
include/modules.h
include/timedialog.h
include/profileedit.h
include/properties.h
include/profile/additionalscriptsdialog.h
include/profile/assetsdialog.h
include/profile/assettreemodel.h
include/profile/cameradialog.h
include/profile/deltatimesdialog.h
include/profile/keybindingsdialog.h
include/profile/marknodesdialog.h
include/profile/metadialog.h
include/profile/modulesdialog.h
include/profile/timedialog.h
include/profile/profileedit.h
include/profile/propertiesdialog.h
)
set(RESOURCE_FILES "")

View File

@@ -28,7 +28,7 @@
#include <QMainWindow>
#include <QString>
#include "profileedit.h"
#include "profile/profileedit.h"
#include "filesystemaccess.h"
#include <openspace/scene/profile.h>
#include <openspace/engine/globals.h>

View File

@@ -31,7 +31,7 @@ namespace openspace { class Profile; }
class QTextEdit;
class AdditionalScripts : public QDialog {
class AdditionalScriptsDialog : public QDialog {
Q_OBJECT
public:
/**
@@ -41,7 +41,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget
*/
explicit AdditionalScripts(openspace::Profile* profile, QWidget* parent);
AdditionalScriptsDialog(openspace::Profile* profile, QWidget* parent);
private slots:
void parseScript();

View File

@@ -35,7 +35,7 @@ namespace openspace { class Profile; }
class QTextEdit;
class QTreeView;
class Assets : public QDialog {
class AssetsDialog : public QDialog {
Q_OBJECT
public:
/**
@@ -48,7 +48,7 @@ public:
* in class #assetTreeModel)
* \param parent Pointer to parent Qt widget
*/
explicit Assets(openspace::Profile* profile, const std::string reportAssets,
AssetsDialog(openspace::Profile* profile, const std::string reportAssets,
QWidget* parent);
/**

View File

@@ -33,7 +33,7 @@ class QLabel;
class QLineEdit;
class QTabWidget;
class Camera : public QDialog {
class CameraDialog : public QDialog {
Q_OBJECT
public:
/**
@@ -43,7 +43,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget (optional)
*/
explicit Camera(openspace::Profile* profile, QWidget* parent);
CameraDialog(openspace::Profile* profile, QWidget* parent);
private slots:
void approved();

View File

@@ -35,7 +35,7 @@ class QListWidget;
class QLineEdit;
class QPushButton;
class DeltaTimes : public QDialog {
class DeltaTimesDialog : public QDialog {
Q_OBJECT
public:
/**
@@ -45,7 +45,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget (optional)
*/
DeltaTimes(openspace::Profile* profile, QWidget* parent);
DeltaTimesDialog(openspace::Profile* profile, QWidget* parent);
/**
* Returns a text summary of the delta time list for display purposes

View File

@@ -39,7 +39,7 @@ class QListWidget;
class QLabel;
class QPushButton;
class Keybindings : public QDialog {
class KeybindingsDialog : public QDialog {
Q_OBJECT
public:
/**
@@ -49,7 +49,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget (optional)
*/
Keybindings(openspace::Profile* profile, QWidget* parent);
KeybindingsDialog(openspace::Profile* profile, QWidget* parent);
/**
* Handles keypress while the Qt dialog window is open

View File

@@ -34,7 +34,7 @@ class QListWidget;
class QListWidgetItem;
class QPushButton;
class MarkNodes : public QDialog {
class MarkNodesDialog : public QDialog {
Q_OBJECT
public:
/**
@@ -44,7 +44,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget
*/
MarkNodes(openspace::Profile* profile, QWidget* parent);
MarkNodesDialog(openspace::Profile* profile, QWidget* parent);
/**
* Handles keypress while the Qt dialog window is open

View File

@@ -32,7 +32,7 @@ namespace openspace { class Profile; }
class QLineEdit;
class QTextEdit;
class Meta : public QDialog {
class MetaDialog : public QDialog {
Q_OBJECT
public:
@@ -43,7 +43,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget
*/
explicit Meta(openspace::Profile* profile, QWidget* parent);
MetaDialog(openspace::Profile* profile, QWidget* parent);
public slots:
void save();

View File

@@ -35,7 +35,7 @@ class QLineEdit;
class QListWidget;
class QPushButton;
class Modules : public QDialog {
class ModulesDialog : public QDialog {
Q_OBJECT
public:
/**
@@ -45,7 +45,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget
*/
Modules(openspace::Profile* profiles, QWidget* parent);
ModulesDialog(openspace::Profile* profiles, QWidget* parent);
/**
* Handles keypress while the Qt dialog window is open

View File

@@ -27,16 +27,16 @@
#include <QDialog>
#include <QWidget>
#include "meta.h"
#include "properties.h"
#include "modules.h"
#include "keybindings.h"
#include "assets.h"
#include "timedialog.h"
#include "additionalscripts.h"
#include "deltatimes.h"
#include "camera.h"
#include "marknodes.h"
#include "profile/metadialog.h"
#include "profile/propertiesdialog.h"
#include "profile/modulesdialog.h"
#include "profile/keybindingsdialog.h"
#include "profile/assetsdialog.h"
#include "profile/timedialog.h"
#include "profile/additionalscriptsdialog.h"
#include "profile/deltatimesdialog.h"
#include "profile/cameradialog.h"
#include "profile/marknodesdialog.h"
#include <openspace/scene/profile.h>
class ProfileEdit : public QDialog {
@@ -116,16 +116,16 @@ private:
bool isReadOnly(std::string profileToSave);
QWidget* _parent;
Meta* _meta;
Properties* _properties;
Modules* _modules;
Keybindings* _keybindings;
Assets* _assets;
Time* _time;
AdditionalScripts* _addedScripts;
DeltaTimes* _deltaTimes;
Camera* _camera;
MarkNodes* _markNodes;
MetaDialog* _meta;
PropertiesDialog* _properties;
ModulesDialog* _modules;
KeybindingsDialog* _keybindings;
AssetsDialog* _assets;
TimeDialog* _time;
AdditionalScriptsDialog* _addedScripts;
DeltaTimesDialog* _deltaTimes;
CameraDialog* _camera;
MarkNodesDialog* _markNodes;
openspace::Profile* _pData;
const std::string _reportedAssets;
bool _saveSelected = false;

View File

@@ -36,9 +36,8 @@ class QLineEdit;
class QListWidget;
class QPushButton;
class Properties : public QDialog {
class PropertiesDialog : public QDialog {
Q_OBJECT
public:
/**
* Constructor for properties class
@@ -47,7 +46,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget (optional)
*/
Properties(openspace::Profile* profile, QWidget* parent);
PropertiesDialog(openspace::Profile* profile, QWidget* parent);
/**
* Handles keypress while the Qt dialog window is open

View File

@@ -34,7 +34,7 @@ class QDateTimeEdit;
class QLabel;
class QLineEdit;
class Time : public QDialog {
class TimeDialog : public QDialog {
Q_OBJECT
public:
/**
@@ -44,7 +44,7 @@ public:
* new or imported profile.
* \param parent Pointer to parent Qt widget (optional)
*/
Time(openspace::Profile* profile, QWidget* parent);
TimeDialog(openspace::Profile* profile, QWidget* parent);
public slots:
void enableAccordingToType(int);

View File

@@ -65,44 +65,48 @@ LauncherWindow QPushButton#small {
* ProfileEdit
*/
ProfileEdit QTextEdit {
min-width: 25em;
min-width: 30em;
}
ProfileEdit QLabel {
font-size: 14px;
}
ProfileEdit QLabel#profile {
font-weight: bold;
}
/*
* Properties
*/
Properties QListWidget {
PropertiesDialog QListWidget {
min-width: 40em;
}
/*
* Assets
*/
Assets QTreeView {
AssetsDialog QTreeView {
min-width: 40em;
}
/*
* Keybindings
*/
Keybindings QListWidget {
KeybindingsDialog QListWidget {
min-width: 40em;
}
/*
* DeltaTimes
*/
DeltaTimes QListWidget {
DeltaTimesDialog QListWidget {
min-width: 40em;
}
/*
* Camera
*/
Camera QLabel#error-message {
CameraDialog QLabel#error-message {
min-width: 10em;
}

View File

@@ -24,7 +24,6 @@
#include <openspace/scene/profile.h>
#include "launcherwindow.h"
#include "profileedit.h"
#include <QPixmap>
#include <QKeyEvent>
#include "filesystemaccess.h"

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "additionalscripts.h"
#include "profile/additionalscriptsdialog.h"
#include <openspace/scene/profile.h>
#include <QDialogButtonBox>
@@ -31,7 +31,8 @@
#include <QTextEdit>
#include <QVBoxLayout>
AdditionalScripts::AdditionalScripts(openspace::Profile* profile, QWidget *parent)
AdditionalScriptsDialog::AdditionalScriptsDialog(openspace::Profile* profile,
QWidget* parent)
: QDialog(parent)
, _profile(profile)
{
@@ -59,11 +60,11 @@ AdditionalScripts::AdditionalScripts(openspace::Profile* profile, QWidget *paren
buttons->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
connect(
buttons, &QDialogButtonBox::accepted,
this, &AdditionalScripts::parseScript
this, &AdditionalScriptsDialog::parseScript
);
connect(
buttons, &QDialogButtonBox::rejected,
this, &AdditionalScripts::reject
this, &AdditionalScriptsDialog::reject
);
layout->addWidget(buttons);
}
@@ -77,7 +78,7 @@ AdditionalScripts::AdditionalScripts(openspace::Profile* profile, QWidget *paren
_textScripts->moveCursor(QTextCursor::MoveOperation::End);
}
void AdditionalScripts::parseScript() {
void AdditionalScriptsDialog::parseScript() {
std::vector<std::string> tmpMultilineStringToVector;
std::istringstream iss(_textScripts->toPlainText().toUtf8().constData());
while (!iss.eof()) {

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "assets.h"
#include "profile/assetsdialog.h"
#include <openspace/scene/profile.h>
#include <QDialogButtonBox>
@@ -115,8 +115,8 @@ namespace {
}
} // namespace
Assets::Assets(openspace::Profile* profile, const std::string reportAssets,
QWidget* parent)
AssetsDialog::AssetsDialog(openspace::Profile* profile, const std::string reportAssets,
QWidget* parent)
: QDialog(parent)
, _profile(profile)
{
@@ -148,7 +148,7 @@ Assets::Assets(openspace::Profile* profile, const std::string reportAssets,
_assetTree->setAnimated(true);
_assetTree->setSortingEnabled(false);
_assetTree->setSelectionMode(QAbstractItemView::SingleSelection);
connect(_assetTree, &QTreeView::clicked, this, &Assets::selected);
connect(_assetTree, &QTreeView::clicked, this, &AssetsDialog::selected);
for (const std::string& a : _profile->assets()) {
@@ -187,13 +187,19 @@ Assets::Assets(openspace::Profile* profile, const std::string reportAssets,
{
QDialogButtonBox* buttons = new QDialogButtonBox;
buttons->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
connect(buttons, &QDialogButtonBox::accepted, this, &Assets::parseSelections);
connect(buttons, &QDialogButtonBox::rejected, this, &Assets::reject);
connect(
buttons, &QDialogButtonBox::accepted,
this, &AssetsDialog::parseSelections
);
connect(
buttons, &QDialogButtonBox::rejected,
this, &AssetsDialog::reject
);
layout->addWidget(buttons);
}
}
QString Assets::createTextSummary() {
QString AssetsDialog::createTextSummary() {
std::vector<std::string> summaryPaths;
std::vector<AssetTreeItem*> summaryItems;
_assetTreeModel.getSelectedAssets(summaryPaths, summaryItems);
@@ -213,7 +219,7 @@ QString Assets::createTextSummary() {
return summary;
}
void Assets::parseSelections() {
void AssetsDialog::parseSelections() {
_profile->clearAssets();
std::vector<std::string> summaryPaths;
std::vector<AssetTreeItem*> summaryItems;
@@ -225,6 +231,6 @@ void Assets::parseSelections() {
accept();
}
void Assets::selected(const QModelIndex& sel) {
void AssetsDialog::selected(const QModelIndex& sel) {
_summary->setText(createTextSummary());
}

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "assettreeitem.h"
#include "profile/assettreeitem.h"
AssetTreeItem::AssetTreeItem(const std::vector<QVariant>& data, AssetTreeItem* parentItem)
: _itemData(data)

View File

@@ -22,8 +22,8 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "assettreeitem.h"
#include "assettreemodel.h"
#include "profile/assettreeitem.h"
#include "profile/assettreemodel.h"
#include <sstream>
#include <QColor>

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "camera.h"
#include "profile/cameradialog.h"
#include <openspace/scene/profile.h>
#include <QDialogButtonBox>
@@ -55,7 +55,7 @@ namespace {
}
} // namespace
Camera::Camera(openspace::Profile* profile, QWidget *parent)
CameraDialog::CameraDialog(openspace::Profile* profile, QWidget *parent)
: QDialog(parent)
, _profile(profile)
{
@@ -63,7 +63,7 @@ Camera::Camera(openspace::Profile* profile, QWidget *parent)
QBoxLayout* layout = new QVBoxLayout(this);
_tabWidget = new QTabWidget;
connect(_tabWidget, &QTabWidget::tabBarClicked, this, &Camera::tabSelect);
connect(_tabWidget, &QTabWidget::tabBarClicked, this, &CameraDialog::tabSelect);
_tabWidget->addTab(createNavStateWidget(), "Navigation State");
_tabWidget->addTab(createGeoWidget(), "Geo State");
layout->addWidget(_tabWidget);
@@ -85,8 +85,8 @@ Camera::Camera(openspace::Profile* profile, QWidget *parent)
QDialogButtonBox* buttons = new QDialogButtonBox;
buttons->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
connect(buttons, &QDialogButtonBox::accepted, this, &Camera::approved);
connect(buttons, &QDialogButtonBox::rejected, this, &Camera::reject);
connect(buttons, &QDialogButtonBox::accepted, this, &CameraDialog::approved);
connect(buttons, &QDialogButtonBox::rejected, this, &CameraDialog::reject);
footerLayout->addWidget(buttons);
layout->addLayout(footerLayout);
@@ -163,7 +163,7 @@ Camera::Camera(openspace::Profile* profile, QWidget *parent)
}
}
QWidget* Camera::createNavStateWidget() {
QWidget* CameraDialog::createNavStateWidget() {
QWidget* box = new QWidget;
QGridLayout* layout = new QGridLayout(box);
@@ -250,7 +250,7 @@ QWidget* Camera::createNavStateWidget() {
return box;
}
QWidget* Camera::createGeoWidget() {
QWidget* CameraDialog::createGeoWidget() {
QWidget* box = new QWidget;
QGridLayout* layout = new QGridLayout(box);
@@ -281,7 +281,7 @@ QWidget* Camera::createGeoWidget() {
return box;
}
bool Camera::areRequiredFormsFilledAndValid() {
bool CameraDialog::areRequiredFormsFilledAndValid() {
bool allFormsOk = true;
_errorMsg->clear();
@@ -346,7 +346,7 @@ bool Camera::areRequiredFormsFilledAndValid() {
return allFormsOk;
}
void Camera::addErrorMsg(QString errorDescription) {
void CameraDialog::addErrorMsg(QString errorDescription) {
QString contents = _errorMsg->text();
if (contents.length() > 0) {
contents += ", ";
@@ -355,7 +355,7 @@ void Camera::addErrorMsg(QString errorDescription) {
_errorMsg->setText(contents);
}
void Camera::approved() {
void CameraDialog::approved() {
if (!areRequiredFormsFilledAndValid()) {
return;
}
@@ -410,7 +410,7 @@ void Camera::approved() {
accept();
}
void Camera::tabSelect(int tabIndex) {
void CameraDialog::tabSelect(int tabIndex) {
_errorMsg->clear();
if (tabIndex == 0) {

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "deltatimes.h"
#include "profile/deltatimesdialog.h"
#include <openspace/scene/profile.h>
#include <QDialogButtonBox>
@@ -59,7 +59,7 @@ namespace {
} // namespace
DeltaTimes::DeltaTimes(openspace::Profile* profile, QWidget *parent)
DeltaTimesDialog::DeltaTimesDialog(openspace::Profile* profile, QWidget *parent)
: QDialog(parent)
, _profile(profile)
{
@@ -69,7 +69,7 @@ DeltaTimes::DeltaTimes(openspace::Profile* profile, QWidget *parent)
_listWidget = new QListWidget;
connect(
_listWidget, &QListWidget::itemSelectionChanged,
this, &DeltaTimes::listItemSelected
this, &DeltaTimesDialog::listItemSelected
);
_listWidget->setAutoScroll(true);
_listWidget->setLayoutMode(QListView::SinglePass);
@@ -79,13 +79,16 @@ DeltaTimes::DeltaTimes(openspace::Profile* profile, QWidget *parent)
{
QBoxLayout* buttonLayout = new QHBoxLayout;
_addButton = new QPushButton("Add Entry");
connect(_addButton, &QPushButton::clicked, this, &DeltaTimes::addDeltaTimeValue);
connect(
_addButton, &QPushButton::clicked,
this, &DeltaTimesDialog::addDeltaTimeValue
);
buttonLayout->addWidget(_addButton);
_removeButton = new QPushButton("Remove LastEntry");
connect(
_removeButton, &QPushButton::clicked,
this, &DeltaTimes::removeDeltaTimeValue
this, &DeltaTimesDialog::removeDeltaTimeValue
);
buttonLayout->addWidget(_removeButton);
@@ -100,7 +103,7 @@ DeltaTimes::DeltaTimes(openspace::Profile* profile, QWidget *parent)
QBoxLayout* box = new QHBoxLayout;
_seconds = new QLineEdit;
_seconds->setValidator(new QDoubleValidator);
connect(_seconds, &QLineEdit::textChanged, this, &DeltaTimes::valueChanged);
connect(_seconds, &QLineEdit::textChanged, this, &DeltaTimesDialog::valueChanged);
box->addWidget(_seconds);
_value = new QLabel;
@@ -113,14 +116,14 @@ DeltaTimes::DeltaTimes(openspace::Profile* profile, QWidget *parent)
_saveButton = new QPushButton("Save");
connect(
_saveButton, &QPushButton::clicked,
this, &DeltaTimes::saveDeltaTimeValue
this, &DeltaTimesDialog::saveDeltaTimeValue
);
box->addWidget(_saveButton);
_discardButton = new QPushButton("Discard");
connect(
_discardButton, &QPushButton::clicked,
this, &DeltaTimes::discardDeltaTimeValue
this, &DeltaTimesDialog::discardDeltaTimeValue
);
box->addWidget(_discardButton);
@@ -144,12 +147,9 @@ DeltaTimes::DeltaTimes(openspace::Profile* profile, QWidget *parent)
_buttonBox->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
connect(
_buttonBox, &QDialogButtonBox::accepted,
this, &DeltaTimes::parseSelections
);
connect(
_buttonBox, &QDialogButtonBox::rejected,
this, &DeltaTimes::reject
this, &DeltaTimesDialog::parseSelections
);
connect(_buttonBox, &QDialogButtonBox::rejected, this, &DeltaTimesDialog::reject);
footer->addWidget(_buttonBox);
layout->addLayout(footer);
}
@@ -165,7 +165,7 @@ DeltaTimes::DeltaTimes(openspace::Profile* profile, QWidget *parent)
transitionEditMode(_listWidget->count() - 1, false);
}
std::string DeltaTimes::createSummaryForDeltaTime(size_t idx, bool forListView) {
std::string DeltaTimesDialog::createSummaryForDeltaTime(size_t idx, bool forListView) {
int k = (idx%10 == 9) ? 0 : idx%10 + 1;
k = (idx == 0) ? 1 : k;
std::string key = std::to_string(k);
@@ -192,7 +192,7 @@ std::string DeltaTimes::createSummaryForDeltaTime(size_t idx, bool forListView)
return s;
}
void DeltaTimes::listItemSelected() {
void DeltaTimesDialog::listItemSelected() {
QListWidgetItem *item = _listWidget->currentItem();
int index = _listWidget->row(item);
@@ -212,7 +212,7 @@ void DeltaTimes::listItemSelected() {
transitionEditMode(index, true);
}
void DeltaTimes::setLabelForKey(int index, bool editMode, std::string color) {
void DeltaTimesDialog::setLabelForKey(int index, bool editMode, std::string color) {
std::string labelS = "Set Simulation Time Increment for key";
if (index >= _data.size()) {
index = _data.size() - 1;
@@ -227,7 +227,7 @@ void DeltaTimes::setLabelForKey(int index, bool editMode, std::string color) {
));
}
QString DeltaTimes::timeDescription(int value) {
QString DeltaTimesDialog::timeDescription(int value) {
if (value == 0) {
return "";
}
@@ -241,7 +241,7 @@ QString DeltaTimes::timeDescription(int value) {
return checkForTimeDescription(i, value);
}
void DeltaTimes::valueChanged(const QString& text) {
void DeltaTimesDialog::valueChanged(const QString& text) {
if (_seconds->text() == "") {
_errorMsg->setText("");
}
@@ -255,14 +255,14 @@ void DeltaTimes::valueChanged(const QString& text) {
}
}
QString DeltaTimes::checkForTimeDescription(int intervalIndex, int value) {
QString DeltaTimesDialog::checkForTimeDescription(int intervalIndex, int value) {
double amount = static_cast<double>(value)
/ TimeIntervals[intervalIndex].secondsPerInterval;
QString description = QString::number(amount, 'g', 2);
return description += " " + TimeIntervals[intervalIndex].intervalName + "/sec";
}
bool DeltaTimes::isLineEmpty(int index) {
bool DeltaTimesDialog::isLineEmpty(int index) {
bool isEmpty = true;
if (!_listWidget->item(index)->text().isEmpty()) {
isEmpty = false;
@@ -273,7 +273,7 @@ bool DeltaTimes::isLineEmpty(int index) {
return isEmpty;
}
void DeltaTimes::addDeltaTimeValue() {
void DeltaTimesDialog::addDeltaTimeValue() {
int currentListSize = _listWidget->count();
const QString messageAddValue = " (Enter integer value below & click 'Save')";
@@ -296,7 +296,7 @@ void DeltaTimes::addDeltaTimeValue() {
_editModeNewItem = true;
}
void DeltaTimes::saveDeltaTimeValue() {
void DeltaTimesDialog::saveDeltaTimeValue() {
QListWidgetItem *item = _listWidget->currentItem();
if (item != nullptr) {
int index = _listWidget->row(item);
@@ -311,7 +311,7 @@ void DeltaTimes::saveDeltaTimeValue() {
}
}
void DeltaTimes::discardDeltaTimeValue(void) {
void DeltaTimesDialog::discardDeltaTimeValue(void) {
listItemSelected();
transitionEditMode(_listWidget->count() - 1, false);
if (_editModeNewItem && !_data.empty() && _data.back() == 0) {
@@ -320,7 +320,7 @@ void DeltaTimes::discardDeltaTimeValue(void) {
_editModeNewItem = false;
}
void DeltaTimes::removeDeltaTimeValue() {
void DeltaTimesDialog::removeDeltaTimeValue() {
if (_listWidget->count() > 0) {
if (_listWidget->count() == 1) {
_data.at(0) = 0;
@@ -337,7 +337,7 @@ void DeltaTimes::removeDeltaTimeValue() {
transitionEditMode(_listWidget->count() - 1, false);
}
void DeltaTimes::transitionEditMode(int index, bool state) {
void DeltaTimesDialog::transitionEditMode(int index, bool state) {
_listWidget->setEnabled(!state);
_addButton->setEnabled(!state);
_removeButton->setEnabled(!state);
@@ -361,7 +361,7 @@ void DeltaTimes::transitionEditMode(int index, bool state) {
_errorMsg->clear();
}
void DeltaTimes::parseSelections() {
void DeltaTimesDialog::parseSelections() {
if ((_data.size() == 1) && (_data.at(0) == 0)) {
_data.clear();
}
@@ -379,7 +379,7 @@ void DeltaTimes::parseSelections() {
accept();
}
void DeltaTimes::keyPressEvent(QKeyEvent* evt) {
void DeltaTimesDialog::keyPressEvent(QKeyEvent* evt) {
if (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) {
if (_editModeNewItem) {
saveDeltaTimeValue();

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "keybindings.h"
#include "profile/keybindingsdialog.h"
#include <openspace/scene/profile.h>
#include <openspace/util/keys.h>
@@ -93,7 +93,7 @@ namespace {
} // namespace
Keybindings::Keybindings(openspace::Profile* profile, QWidget *parent)
KeybindingsDialog::KeybindingsDialog(openspace::Profile* profile, QWidget *parent)
: QDialog(parent)
, _profile(profile)
, _data(_profile->keybindings())
@@ -105,7 +105,7 @@ Keybindings::Keybindings(openspace::Profile* profile, QWidget *parent)
_list = new QListWidget;
connect(
_list, &QListWidget::itemSelectionChanged,
this, &Keybindings::listItemSelected
this, &KeybindingsDialog::listItemSelected
);
_list->setAlternatingRowColors(true);
_list->setMovement(QListView::Free);
@@ -121,11 +121,17 @@ Keybindings::Keybindings(openspace::Profile* profile, QWidget *parent)
{
QBoxLayout* box = new QHBoxLayout;
_addButton = new QPushButton("Add new");
connect(_addButton, &QPushButton::clicked, this, &Keybindings::listItemAdded);
connect(
_addButton, &QPushButton::clicked,
this, &KeybindingsDialog::listItemAdded
);
box->addWidget(_addButton);
_removeButton = new QPushButton("Remove");
connect(_removeButton, &QPushButton::clicked, this, &Keybindings::listItemRemove);
connect(
_removeButton, &QPushButton::clicked,
this, &KeybindingsDialog::listItemRemove
);
box->addWidget(_removeButton);
box->addStretch();
layout->addLayout(box);
@@ -216,13 +222,16 @@ Keybindings::Keybindings(openspace::Profile* profile, QWidget *parent)
QBoxLayout* buttonBox = new QHBoxLayout;
_saveButton = new QPushButton("Save");
connect(_saveButton, &QPushButton::clicked, this, &Keybindings::listItemSave);
connect(
_saveButton, &QPushButton::clicked,
this, &KeybindingsDialog::listItemSave
);
buttonBox->addWidget(_saveButton);
_cancelButton = new QPushButton("Cancel");
connect(
_cancelButton, &QPushButton::clicked,
this, &Keybindings::listItemCancelSave
this, &KeybindingsDialog::listItemCancelSave
);
buttonBox->addWidget(_cancelButton);
buttonBox->addStretch();
@@ -247,11 +256,11 @@ Keybindings::Keybindings(openspace::Profile* profile, QWidget *parent)
_buttonBox->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
QObject::connect(
_buttonBox, &QDialogButtonBox::accepted,
this, &Keybindings::parseSelections
this, &KeybindingsDialog::parseSelections
);
QObject::connect(
_buttonBox, &QDialogButtonBox::rejected,
this, &Keybindings::reject
this, &KeybindingsDialog::reject
);
footerLayout->addWidget(_buttonBox);
layout->addLayout(footerLayout);
@@ -260,7 +269,7 @@ Keybindings::Keybindings(openspace::Profile* profile, QWidget *parent)
transitionFromEditMode();
}
void Keybindings::listItemSelected(void) {
void KeybindingsDialog::listItemSelected(void) {
QListWidgetItem *item = _list->currentItem();
int index = _list->row(item);
@@ -285,12 +294,12 @@ void Keybindings::listItemSelected(void) {
transitionToEditMode();
}
int Keybindings::indexInKeyMapping(std::vector<int>& mapVector, int keyInt) {
int KeybindingsDialog::indexInKeyMapping(std::vector<int>& mapVector, int keyInt) {
auto it = std::find(mapVector.begin(), mapVector.end(), keyInt);
return std::distance(mapVector.begin(), it);
}
bool Keybindings::isLineEmpty(int index) {
bool KeybindingsDialog::isLineEmpty(int index) {
bool isEmpty = true;
if (!_list->item(index)->text().isEmpty()) {
isEmpty = false;
@@ -301,7 +310,7 @@ bool Keybindings::isLineEmpty(int index) {
return isEmpty;
}
void Keybindings::listItemAdded(void) {
void KeybindingsDialog::listItemAdded(void) {
int currentListSize = _list->count();
if ((currentListSize == 1) && (isLineEmpty(0))) {
@@ -332,7 +341,7 @@ void Keybindings::listItemAdded(void) {
_editModeNewItem = true;
}
void Keybindings::listItemSave(void) {
void KeybindingsDialog::listItemSave(void) {
if (!areRequiredFormsFilled()) {
return;
}
@@ -357,7 +366,7 @@ void Keybindings::listItemSave(void) {
transitionFromEditMode();
}
bool Keybindings::areRequiredFormsFilled() {
bool KeybindingsDialog::areRequiredFormsFilled() {
bool requiredFormsFilled = true;
std::string errors;
if (_keyCombo->currentIndex() < 0) {
@@ -382,7 +391,7 @@ bool Keybindings::areRequiredFormsFilled() {
return requiredFormsFilled;
}
void Keybindings::listItemCancelSave(void) {
void KeybindingsDialog::listItemCancelSave(void) {
listItemSelected();
transitionFromEditMode();
if (_editModeNewItem && !_data.empty() &&
@@ -394,7 +403,7 @@ void Keybindings::listItemCancelSave(void) {
_editModeNewItem = false;
}
void Keybindings::listItemRemove(void) {
void KeybindingsDialog::listItemRemove(void) {
if (_list->count() > 0) {
if (_list->count() == 1) {
// Special case where last remaining item is being removed (QListWidget does
@@ -416,7 +425,7 @@ void Keybindings::listItemRemove(void) {
transitionFromEditMode();
}
void Keybindings::transitionToEditMode() {
void KeybindingsDialog::transitionToEditMode() {
_list->setDisabled(true);
_addButton->setDisabled(true);
_removeButton->setDisabled(true);
@@ -434,7 +443,7 @@ void Keybindings::transitionToEditMode() {
_errorMsg->setText("");
}
void Keybindings::transitionFromEditMode(void) {
void KeybindingsDialog::transitionFromEditMode(void) {
_list->setDisabled(false);
_addButton->setDisabled(false);
_removeButton->setDisabled(false);
@@ -452,7 +461,7 @@ void Keybindings::transitionFromEditMode(void) {
_errorMsg->setText("");
}
void Keybindings::editBoxDisabled(bool disabled) {
void KeybindingsDialog::editBoxDisabled(bool disabled) {
_keyLabel->setDisabled(disabled);
_keyCombo->setDisabled(disabled);
_keyModLabel->setDisabled(disabled);
@@ -470,8 +479,8 @@ void Keybindings::editBoxDisabled(bool disabled) {
_saveButton->setDisabled(disabled);
}
void Keybindings::parseSelections() {
//Handle case with only one remaining but empty line
void KeybindingsDialog::parseSelections() {
// Handle case with only one remaining but empty line
if ((_data.size() == 1) && (_data.at(0).name.empty())) {
_data.clear();
}
@@ -479,7 +488,7 @@ void Keybindings::parseSelections() {
accept();
}
void Keybindings::keyPressEvent(QKeyEvent *evt) {
void KeybindingsDialog::keyPressEvent(QKeyEvent* evt) {
if (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) {
return;
}

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "marknodes.h"
#include "profile/marknodesdialog.h"
#include <openspace/scene/profile.h>
#include <QDialogButtonBox>
@@ -34,7 +34,7 @@
#include <QPushButton>
#include <QVBoxLayout>
MarkNodes::MarkNodes(openspace::Profile* profile, QWidget* parent)
MarkNodesDialog::MarkNodesDialog(openspace::Profile* profile, QWidget* parent)
: QDialog(parent)
, _profile(profile)
, _data(_profile->markNodes())
@@ -45,7 +45,7 @@ MarkNodes::MarkNodes(openspace::Profile* profile, QWidget* parent)
_list = new QListWidget;
connect(
_list, &QListWidget::itemSelectionChanged,
this, &MarkNodes::listItemSelected
this, &MarkNodesDialog::listItemSelected
);
_list->setAlternatingRowColors(true);
_list->setMovement(QListView::Free);
@@ -60,7 +60,7 @@ MarkNodes::MarkNodes(openspace::Profile* profile, QWidget* parent)
layout->addWidget(_list);
_removeButton = new QPushButton("Remove");
connect(_removeButton, &QPushButton::clicked, this, &MarkNodes::listItemRemove);
connect(_removeButton, &QPushButton::clicked, this, &MarkNodesDialog::listItemRemove);
layout->addWidget(_removeButton);
{
@@ -73,7 +73,10 @@ MarkNodes::MarkNodes(openspace::Profile* profile, QWidget* parent)
box->addWidget(_newNode);
QPushButton* addButton = new QPushButton("Add new");
connect(addButton, &QPushButton::clicked, this, &MarkNodes::listItemAdded);
connect(
addButton, &QPushButton::clicked,
this, &MarkNodesDialog::listItemAdded
);
box->addWidget(addButton);
layout->addLayout(box);
}
@@ -82,18 +85,21 @@ MarkNodes::MarkNodes(openspace::Profile* profile, QWidget* parent)
buttons->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
QObject::connect(
buttons, &QDialogButtonBox::accepted,
this, &MarkNodes::parseSelections
this, &MarkNodesDialog::parseSelections
);
QObject::connect(
buttons, &QDialogButtonBox::rejected,
this, &MarkNodesDialog::reject
);
QObject::connect(buttons, &QDialogButtonBox::rejected, this, &MarkNodes::reject);
layout->addWidget(buttons);
}
}
void MarkNodes::listItemSelected(void) {
void MarkNodesDialog::listItemSelected(void) {
_removeButton->setEnabled(true);
}
void MarkNodes::listItemAdded(void) {
void MarkNodesDialog::listItemAdded(void) {
if (_newNode->text().isEmpty()) {
return;
}
@@ -116,7 +122,7 @@ void MarkNodes::listItemAdded(void) {
_newNode->clear();
}
void MarkNodes::listItemRemove() {
void MarkNodesDialog::listItemRemove() {
QListWidgetItem* item = _list->currentItem();
int index = _list->row(item);
@@ -129,12 +135,12 @@ void MarkNodes::listItemRemove() {
_markedNodesListItems.erase(_markedNodesListItems.begin() + index);
}
void MarkNodes::parseSelections() {
void MarkNodesDialog::parseSelections() {
_profile->setMarkNodes(_data);
accept();
}
void MarkNodes::keyPressEvent(QKeyEvent *evt) {
void MarkNodesDialog::keyPressEvent(QKeyEvent *evt) {
if (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) {
if (_newNode->text().length() > 0 && _newNode->hasFocus()) {
listItemAdded();

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "meta.h"
#include "profile/metadialog.h"
#include <openspace/scene/profile.h>
#include <QDialogButtonBox>
@@ -33,7 +33,7 @@
#include <QVBoxLayout>
#include <algorithm>
Meta::Meta(openspace::Profile* profile, QWidget *parent)
MetaDialog::MetaDialog(openspace::Profile* profile, QWidget *parent)
: QDialog(parent)
, _profile(profile)
{
@@ -67,8 +67,8 @@ Meta::Meta(openspace::Profile* profile, QWidget *parent)
QDialogButtonBox* buttons = new QDialogButtonBox;
buttons->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
QObject::connect(buttons, &QDialogButtonBox::accepted, this, &Meta::save);
QObject::connect(buttons, &QDialogButtonBox::rejected, this, &Meta::reject);
QObject::connect(buttons, &QDialogButtonBox::accepted, this, &MetaDialog::save);
QObject::connect(buttons, &QDialogButtonBox::rejected, this, &MetaDialog::reject);
layout->addWidget(buttons);
@@ -95,7 +95,7 @@ Meta::Meta(openspace::Profile* profile, QWidget *parent)
}
}
void Meta::save() {
void MetaDialog::save() {
const bool allEmpty =
_nameEdit->text().isEmpty() && _versionEdit->text().isEmpty() &&
_descriptionEdit->toPlainText().isEmpty() && _authorEdit->text().isEmpty() &&

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "modules.h"
#include "profile/modulesdialog.h"
#include <QDialogButtonBox>
#include <QEvent>
@@ -33,7 +33,7 @@
#include <QPushButton>
#include <QVBoxLayout>
Modules::Modules(openspace::Profile* profile, QWidget *parent)
ModulesDialog::ModulesDialog(openspace::Profile* profile, QWidget *parent)
: QDialog(parent)
, _profile(profile)
, _data(_profile->modules())
@@ -46,7 +46,7 @@ Modules::Modules(openspace::Profile* profile, QWidget *parent)
_list = new QListWidget;
connect(
_list, &QListWidget::itemSelectionChanged,
this, &Modules::listItemSelected
this, &ModulesDialog::listItemSelected
);
_list->setAlternatingRowColors(true);
_list->setMovement(QListView::Free);
@@ -60,11 +60,14 @@ Modules::Modules(openspace::Profile* profile, QWidget *parent)
{
QBoxLayout* box = new QHBoxLayout;
_buttonAdd = new QPushButton("Add new");
connect(_buttonAdd, &QPushButton::clicked, this, &Modules::listItemAdded);
connect(_buttonAdd, &QPushButton::clicked, this, &ModulesDialog::listItemAdded);
box->addWidget(_buttonAdd);
_buttonRemove = new QPushButton("Remove");
connect(_buttonRemove, &QPushButton::clicked, this, &Modules::listItemRemove);
connect(
_buttonRemove, &QPushButton::clicked,
this, &ModulesDialog::listItemRemove
);
box->addWidget(_buttonRemove);
box->addStretch();
@@ -99,12 +102,15 @@ Modules::Modules(openspace::Profile* profile, QWidget *parent)
QBoxLayout* box = new QHBoxLayout;
_buttonSave = new QPushButton("Save");
_buttonSave->setToolTip("Save module changes to the above list");
connect(_buttonSave, &QPushButton::clicked, this, &Modules::listItemSave);
connect(_buttonSave, &QPushButton::clicked, this, &ModulesDialog::listItemSave);
box->addWidget(_buttonSave);
_buttonCancel = new QPushButton("Cancel");
_buttonCancel->setToolTip("Cancel adding this module to the above list");
connect(_buttonCancel, &QPushButton::clicked, this, &Modules::listItemCancelSave);
connect(
_buttonCancel, &QPushButton::clicked,
this, &ModulesDialog::listItemCancelSave
);
box->addWidget(_buttonCancel);
box->addStretch();
@@ -129,11 +135,11 @@ Modules::Modules(openspace::Profile* profile, QWidget *parent)
_buttonBox->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
QObject::connect(
_buttonBox, &QDialogButtonBox::accepted,
this, &Modules::parseSelections
this, &ModulesDialog::parseSelections
);
QObject::connect(
_buttonBox, &QDialogButtonBox::rejected,
this, &Modules::reject
this, &ModulesDialog::reject
);
footerLayout->addWidget(_buttonBox);
layout->addLayout(footerLayout);
@@ -142,7 +148,7 @@ Modules::Modules(openspace::Profile* profile, QWidget *parent)
transitionFromEditMode();
}
QString Modules::createOneLineSummary(openspace::Profile::Module m) {
QString ModulesDialog::createOneLineSummary(openspace::Profile::Module m) {
QString summary = QString(m.name.c_str());
bool hasCommandForLoaded = (m.loadedInstruction->length() > 0);
bool hasCommandForNotLoaded = (m.notLoadedInstruction->length() > 0);
@@ -162,7 +168,7 @@ QString Modules::createOneLineSummary(openspace::Profile::Module m) {
return summary;
}
void Modules::listItemSelected() {
void ModulesDialog::listItemSelected() {
QListWidgetItem *item = _list->currentItem();
int index = _list->row(item);
@@ -185,7 +191,7 @@ void Modules::listItemSelected() {
transitionToEditMode();
}
bool Modules::isLineEmpty(int index) {
bool ModulesDialog::isLineEmpty(int index) {
bool isEmpty = true;
if (!_list->item(index)->text().isEmpty()) {
isEmpty = false;
@@ -196,7 +202,7 @@ bool Modules::isLineEmpty(int index) {
return isEmpty;
}
void Modules::listItemAdded(void) {
void ModulesDialog::listItemAdded(void) {
int currentListSize = _list->count();
if ((currentListSize == 1) && (isLineEmpty(0))) {
@@ -236,7 +242,7 @@ void Modules::listItemAdded(void) {
_editModeNewItem = true;
}
void Modules::listItemSave(void) {
void ModulesDialog::listItemSave(void) {
if (_moduleEdit->text().isEmpty()) {
//ui->label_module->setText("<font color='red'>Module</font>");
_errorMsg->setText("Missing module name");
@@ -256,7 +262,7 @@ void Modules::listItemSave(void) {
_editModeNewItem = false;
}
void Modules::listItemCancelSave(void) {
void ModulesDialog::listItemCancelSave(void) {
transitionFromEditMode();
if (_editModeNewItem) {
if (_data.size() > 0) {
@@ -268,7 +274,7 @@ void Modules::listItemCancelSave(void) {
_editModeNewItem = false;
}
void Modules::listItemRemove(void) {
void ModulesDialog::listItemRemove(void) {
if (_list->count() > 0) {
if (_list->currentRow() >= 0 && _list->currentRow() < _list->count()) {
if (_list->count() == 1) {
@@ -291,7 +297,7 @@ void Modules::listItemRemove(void) {
transitionFromEditMode();
}
void Modules::transitionToEditMode(void) {
void ModulesDialog::transitionToEditMode(void) {
_list->setDisabled(true);
_buttonAdd->setDisabled(true);
_buttonRemove->setDisabled(true);
@@ -306,7 +312,7 @@ void Modules::transitionToEditMode(void) {
_errorMsg->setText("");
}
void Modules::transitionFromEditMode(void) {
void ModulesDialog::transitionFromEditMode(void) {
_list->setDisabled(false);
_buttonAdd->setDisabled(false);
_buttonRemove->setDisabled(false);
@@ -321,7 +327,7 @@ void Modules::transitionFromEditMode(void) {
_errorMsg->setText("");
}
void Modules::editBoxDisabled(bool disabled) {
void ModulesDialog::editBoxDisabled(bool disabled) {
_moduleLabel->setDisabled(disabled);
_moduleEdit->setDisabled(disabled);
_loadedLabel->setDisabled(disabled);
@@ -332,7 +338,7 @@ void Modules::editBoxDisabled(bool disabled) {
_buttonSave->setDisabled(disabled);
}
void Modules::parseSelections() {
void ModulesDialog::parseSelections() {
// Handle case with only one remaining but empty line
if ((_data.size() == 1) && (_data.at(0).name.empty())) {
_data.clear();
@@ -341,14 +347,14 @@ void Modules::parseSelections() {
accept();
}
void Modules::keyPressEvent(QKeyEvent* evt) {
void ModulesDialog::keyPressEvent(QKeyEvent* evt) {
if (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) {
if (_editModeNewItem) {
listItemSave();
}
return;
}
else if(evt->key() == Qt::Key_Escape) {
else if (evt->key() == Qt::Key_Escape) {
if (_editModeNewItem) {
listItemCancelSave();
return;

View File

@@ -23,7 +23,7 @@
****************************************************************************************/
#include <openspace/scene/profile.h>
#include "profileedit.h"
#include "profile/profileedit.h"
#include "filesystemaccess.h"
#include <QKeyEvent>
#include <iostream>
@@ -53,6 +53,7 @@ ProfileEdit::ProfileEdit(openspace::Profile* profile, const std::string reported
{
QBoxLayout* container = new QHBoxLayout;
QLabel* profileLabel = new QLabel("Profile Name:");
profileLabel->setObjectName("profile");
container->addWidget(profileLabel);
_profileEdit = new QLineEdit;
@@ -309,7 +310,7 @@ ProfileEdit::ProfileEdit(openspace::Profile* profile, const std::string reported
);
connect(
buttons, &QDialogButtonBox::rejected,
this, &DeltaTimes::reject
this, &ProfileEdit::reject
);
footer->addWidget(buttons);
layout->addLayout(footer);
@@ -367,7 +368,7 @@ void ProfileEdit::duplicateProfile() {
void ProfileEdit::openMeta() {
_errorMsg->setText("");
if (_pData) {
_meta = new Meta(_pData, this);
_meta = new MetaDialog(_pData, this);
_meta->exec();
delete _meta;
}
@@ -376,7 +377,7 @@ void ProfileEdit::openMeta() {
void ProfileEdit::openModules() {
_errorMsg->setText("");
if (_pData) {
_modules = new Modules(_pData, this);
_modules = new ModulesDialog(_pData, this);
_modules->exec();
labelText(_pData, _pData->modules().size(), "Modules", _modulesLabel);
delete _modules;
@@ -386,7 +387,7 @@ void ProfileEdit::openModules() {
void ProfileEdit::openProperties() {
_errorMsg->setText("");
if (_pData) {
_properties = new Properties(_pData, this);
_properties = new PropertiesDialog(_pData, this);
_properties->exec();
labelText(_pData, _pData->properties().size(), "Properties", _propertiesLabel);
_propertiesEdit->setText(summarizeText_properties());
@@ -397,7 +398,7 @@ void ProfileEdit::openProperties() {
void ProfileEdit::openKeybindings() {
_errorMsg->setText("");
if (_pData) {
_keybindings = new Keybindings(_pData, this);
_keybindings = new KeybindingsDialog(_pData, this);
_keybindings->exec();
labelText(_pData, _pData->keybindings().size(), "Keybindings",
_keybindingsLabel
@@ -410,7 +411,7 @@ void ProfileEdit::openKeybindings() {
void ProfileEdit::openAssets() {
_errorMsg->setText("");
if (_pData) {
_assets = new Assets(_pData, _reportedAssets, this);
_assets = new AssetsDialog(_pData, _reportedAssets, this);
_assets->exec();
labelText(_pData, _pData->assets().size(), "Assets", _assetsLabel);
_assetsEdit->setText(_assets->createTextSummary());
@@ -422,7 +423,7 @@ void ProfileEdit::openAssets() {
void ProfileEdit::openTime() {
_errorMsg->setText("");
if (_pData) {
_time = new Time(_pData, this);
_time = new TimeDialog(_pData, this);
_time->exec();
delete _time;
}
@@ -431,7 +432,7 @@ void ProfileEdit::openTime() {
void ProfileEdit::openDeltaTimes() {
_errorMsg->setText("");
if (_pData) {
_deltaTimes = new DeltaTimes(_pData, this);
_deltaTimes = new DeltaTimesDialog(_pData, this);
_deltaTimes->exec();
labelText(_pData, _pData->deltaTimes().size(), "Simulation Time Increments",
_deltaTimesLabel
@@ -443,7 +444,7 @@ void ProfileEdit::openDeltaTimes() {
void ProfileEdit::openAddedScripts() {
_errorMsg->setText("");
if (_pData) {
_addedScripts = new AdditionalScripts(_pData, this);
_addedScripts = new AdditionalScriptsDialog(_pData, this);
_addedScripts->exec();
delete _addedScripts;
}
@@ -452,7 +453,7 @@ void ProfileEdit::openAddedScripts() {
void ProfileEdit::openCamera() {
_errorMsg->setText("");
if (_pData) {
_camera = new Camera(_pData, this);
_camera = new CameraDialog(_pData, this);
_camera->exec();
delete _camera;
}
@@ -461,7 +462,7 @@ void ProfileEdit::openCamera() {
void ProfileEdit::openMarkNodes() {
_errorMsg->setText("");
if (_pData) {
_markNodes = new MarkNodes(_pData, this);
_markNodes = new MarkNodesDialog(_pData, this);
_markNodes->exec();
labelText(_pData, _pData->markNodes().size(), "Mark Interesting Nodes",
_interestingNodesLabel

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "properties.h"
#include "profile/propertiesdialog.h"
#include <QComboBox>
#include <QDialogButtonBox>
@@ -43,7 +43,7 @@ namespace {
};
} // namespace
Properties::Properties(openspace::Profile* profile, QWidget *parent)
PropertiesDialog::PropertiesDialog(openspace::Profile* profile, QWidget *parent)
: QDialog(parent)
, _profile(profile)
, _data(_profile->properties())
@@ -55,7 +55,7 @@ Properties::Properties(openspace::Profile* profile, QWidget *parent)
_list = new QListWidget;
connect(
_list, &QListWidget::itemSelectionChanged,
this, &Properties::listItemSelected
this, &PropertiesDialog::listItemSelected
);
for (size_t i = 0; i < _data.size(); ++i) {
_list->addItem(new QListWidgetItem(createOneLineSummary(_data[i])));
@@ -65,11 +65,17 @@ Properties::Properties(openspace::Profile* profile, QWidget *parent)
{
QBoxLayout* box = new QHBoxLayout;
_addButton = new QPushButton("Add New");
connect(_addButton, &QPushButton::clicked, this, &Properties::listItemAdded);
connect(
_addButton, &QPushButton::clicked,
this, &PropertiesDialog::listItemAdded
);
box->addWidget(_addButton);
_removeButton = new QPushButton("Remove");
connect(_removeButton, &QPushButton::clicked, this, &Properties::listItemRemove);
connect(
_removeButton, &QPushButton::clicked,
this, &PropertiesDialog::listItemRemove
);
box->addWidget(_removeButton);
box->addStretch();
@@ -104,13 +110,16 @@ Properties::Properties(openspace::Profile* profile, QWidget *parent)
{
QBoxLayout* box = new QHBoxLayout;
_saveButton = new QPushButton("Save");
connect(_saveButton, &QPushButton::clicked, this, &Properties::listItemSave);
connect(
_saveButton, &QPushButton::clicked,
this, &PropertiesDialog::listItemSave
);
box->addWidget(_saveButton);
_cancelButton = new QPushButton("Cancel");
connect(
_cancelButton, &QPushButton::clicked,
this, &Properties::listItemCancelSave
this, &PropertiesDialog::listItemCancelSave
);
box->addWidget(_cancelButton);
@@ -132,11 +141,11 @@ Properties::Properties(openspace::Profile* profile, QWidget *parent)
connect(
_buttonBox, &QDialogButtonBox::accepted,
this, &Properties::parseSelections
this, &PropertiesDialog::parseSelections
);
QObject::connect(
connect(
_buttonBox, &QDialogButtonBox::rejected,
this, &Properties::reject
this, &PropertiesDialog::reject
);
footerLayout->addWidget(_buttonBox);
layout->addLayout(footerLayout);
@@ -145,7 +154,7 @@ Properties::Properties(openspace::Profile* profile, QWidget *parent)
transitionFromEditMode();
}
QString Properties::createOneLineSummary(openspace::Profile::Property p) {
QString PropertiesDialog::createOneLineSummary(openspace::Profile::Property p) {
QString summary = QString(p.name.c_str());
summary += " = ";
summary += QString(p.value.c_str());
@@ -157,7 +166,7 @@ QString Properties::createOneLineSummary(openspace::Profile::Property p) {
return summary;
}
void Properties::listItemSelected() {
void PropertiesDialog::listItemSelected() {
QListWidgetItem* item = _list->currentItem();
int index = _list->row(item);
@@ -175,7 +184,7 @@ void Properties::listItemSelected() {
transitionToEditMode();
}
bool Properties::isLineEmpty(int index) {
bool PropertiesDialog::isLineEmpty(int index) {
bool isEmpty = true;
if (!_list->item(index)->text().isEmpty()) {
isEmpty = false;
@@ -186,7 +195,7 @@ bool Properties::isLineEmpty(int index) {
return isEmpty;
}
void Properties::listItemAdded(void) {
void PropertiesDialog::listItemAdded(void) {
int currentListSize = _list->count();
if ((currentListSize == 1) && (isLineEmpty(0))) {
@@ -213,7 +222,7 @@ void Properties::listItemAdded(void) {
_editModeNewItem = true;
}
void Properties::listItemSave(void) {
void PropertiesDialog::listItemSave(void) {
if (!areRequiredFormsFilled()) {
return;
}
@@ -238,7 +247,7 @@ void Properties::listItemSave(void) {
_editModeNewItem = false;
}
bool Properties::areRequiredFormsFilled() {
bool PropertiesDialog::areRequiredFormsFilled() {
bool requiredFormsFilled = true;
QString errors;
if (_propertyEdit->text().length() == 0) {
@@ -256,7 +265,7 @@ bool Properties::areRequiredFormsFilled() {
return requiredFormsFilled;
}
void Properties::listItemCancelSave(void) {
void PropertiesDialog::listItemCancelSave(void) {
listItemSelected();
transitionFromEditMode();
if (_editModeNewItem) {
@@ -269,7 +278,7 @@ void Properties::listItemCancelSave(void) {
_editModeNewItem = false;
}
void Properties::listItemRemove(void) {
void PropertiesDialog::listItemRemove(void) {
if (_list->count() > 0) {
if (_list->currentRow() >= 0 && _list->currentRow() < _list->count()) {
if (_list->count() == 1) {
@@ -292,7 +301,7 @@ void Properties::listItemRemove(void) {
transitionFromEditMode();
}
void Properties::transitionToEditMode(void) {
void PropertiesDialog::transitionToEditMode(void) {
_list->setDisabled(true);
_addButton->setDisabled(true);
_removeButton->setDisabled(true);
@@ -307,7 +316,7 @@ void Properties::transitionToEditMode(void) {
_errorMsg->setText("");
}
void Properties::transitionFromEditMode(void) {
void PropertiesDialog::transitionFromEditMode(void) {
_list->setDisabled(false);
_addButton->setDisabled(false);
_removeButton->setDisabled(false);
@@ -322,7 +331,7 @@ void Properties::transitionFromEditMode(void) {
_errorMsg->setText("");
}
void Properties::editBoxDisabled(bool disabled) {
void PropertiesDialog::editBoxDisabled(bool disabled) {
_commandLabel->setDisabled(disabled);
_commandCombo->setDisabled(disabled);
_propertyLabel->setDisabled(disabled);
@@ -333,7 +342,7 @@ void Properties::editBoxDisabled(bool disabled) {
_cancelButton->setDisabled(disabled);
}
void Properties::parseSelections() {
void PropertiesDialog::parseSelections() {
// Handle case with only one remaining but empty line
if ((_data.size() == 1) && (_data.at(0).name.compare("") == 0)) {
_data.clear();
@@ -342,14 +351,14 @@ void Properties::parseSelections() {
accept();
}
void Properties::keyPressEvent(QKeyEvent* evt) {
if(evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) {
void PropertiesDialog::keyPressEvent(QKeyEvent* evt) {
if (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) {
if (_editModeNewItem) {
listItemSave();
}
return;
}
else if(evt->key() == Qt::Key_Escape) {
else if (evt->key() == Qt::Key_Escape) {
if (_editModeNewItem) {
listItemCancelSave();
return;

View File

@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include "timedialog.h"
#include "profile/timedialog.h"
#include <QComboBox>
#include <QDateTimeEdit>
@@ -36,7 +36,7 @@
using namespace openspace;
Time::Time(openspace::Profile* profile, QWidget* parent)
TimeDialog::TimeDialog(openspace::Profile* profile, QWidget* parent)
: QDialog(parent)
, _profile(profile)
{
@@ -50,7 +50,7 @@ Time::Time(openspace::Profile* profile, QWidget* parent)
_typeCombo->setToolTip("Types: Absolute defined time or Relative to actual time");
connect(
_typeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
this, &Time::enableAccordingToType
this, &TimeDialog::enableAccordingToType
);
layout->addWidget(_typeCombo);
}
@@ -81,8 +81,8 @@ Time::Time(openspace::Profile* profile, QWidget* parent)
QDialogButtonBox* buttons = new QDialogButtonBox;
buttons->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
connect(buttons, &QDialogButtonBox::accepted, this, &Time::approved);
QObject::connect(buttons, &QDialogButtonBox::rejected, this, &Time::reject);
connect(buttons, &QDialogButtonBox::accepted, this, &TimeDialog::approved);
QObject::connect(buttons, &QDialogButtonBox::rejected, this, &TimeDialog::reject);
layout->addWidget(buttons);
}
@@ -110,7 +110,7 @@ Time::Time(openspace::Profile* profile, QWidget* parent)
enableAccordingToType(static_cast<int>(_data.type));
}
void Time::enableAccordingToType(int idx) {
void TimeDialog::enableAccordingToType(int idx) {
Profile::Time::Type comboIdx = static_cast<Profile::Time::Type>(idx);
bool setFormatForAbsolute = (comboIdx == Profile::Time::Type::Absolute);
enableFormatForAbsolute(setFormatForAbsolute);
@@ -137,14 +137,14 @@ void Time::enableAccordingToType(int idx) {
}
}
void Time::enableFormatForAbsolute(bool enableAbs) {
void TimeDialog::enableFormatForAbsolute(bool enableAbs) {
_absoluteLabel->setEnabled(enableAbs);
_absoluteEdit->setEnabled(enableAbs);
_relativeLabel->setEnabled(!enableAbs);
_relativeEdit->setEnabled(!enableAbs);
}
void Time::approved() {
void TimeDialog::approved() {
constexpr const int Relative = static_cast<int>(Profile::Time::Type::Relative);
if (_typeCombo->currentIndex() == Relative) {
if (_relativeEdit->text().isEmpty()) {