Commit 545d1247 authored by ElonOlsson's avatar ElonOlsson
Browse files

merge master

parents 364eb038 36a4ba53
Showing with 156 additions and 85 deletions
+156 -85
......@@ -58,7 +58,7 @@ public:
private slots:
void openSaveAs();
void typeOnChange(int index);
void downloadProgress(qint64 ist, qint64 max);
void downloadProgress(int value, int max);
void importTimeRange();
#ifdef OPENSPACE_MODULE_SPACE_ENABLED
......
......@@ -26,16 +26,14 @@
#define __OPENSPACE_UI_LAUNCHER___SCRIPTLOG___H__
#include <QDialog>
#include <QListWidget>
class QLineEdit;
class QListWidget;
class QPushButton;
class ScriptlogDialog final : public QDialog {
Q_OBJECT
public:
/**
* Constructor for ScriptlogDialog class
*
* \param parent Pointer to parent Qt widget
*/
ScriptlogDialog(QWidget* parent);
signals:
......@@ -46,8 +44,13 @@ private slots:
private:
void createWidgets();
void loadScriptFile();
void updateScriptList();
QListWidget* _scriptlogList = nullptr;
QLineEdit* _filter = nullptr;
QPushButton* _reloadFile = nullptr;
std::vector<std::string> _scripts;
};
#endif // __OPENSPACE_UI_LAUNCHER___SCRIPTLOG___H__
......@@ -149,25 +149,32 @@ CameraDialog QLabel#error-message {
min-width: 10em;
}
/*
* ScriptlogDialog
*/
ScriptlogDialog QListWidget {
min-width: 60em;
}
/*
* Horizons dialog
*/
QPlainTextEdit#log {
HorizonsDialog QPlainTextEdit#log {
font-family: Courier;
}
QComboBox#mono {
HorizonsDialog QComboBox#mono {
font-family: Courier;
}
QLabel#thin {
HorizonsDialog QLabel#thin {
font-weight: normal;
}
QLabel#error {
HorizonsDialog QLabel#error {
color: rgb(221, 17, 17);
}
QLabel#normal {
HorizonsDialog QLabel#normal {
color: rgb(0, 0, 0);
}
......@@ -490,8 +490,8 @@ void ActionDialog::actionRemove() {
clearActionFields();
_keybindingWidgets.action->clear();
for (const Profile::Action& action : _actionData) {
_keybindingWidgets.action->addItem(QString::fromStdString(action.identifier));
for (const Profile::Action& a : _actionData) {
_keybindingWidgets.action->addItem(QString::fromStdString(a.identifier));
}
clearKeybindingFields();
return;
......@@ -596,8 +596,8 @@ void ActionDialog::actionSaved() {
// Update the list of actions available in the action chooser
_keybindingWidgets.action->clear();
for (const Profile::Action& action : _actionData) {
_keybindingWidgets.action->addItem(QString::fromStdString(action.identifier));
for (const Profile::Action& a : _actionData) {
_keybindingWidgets.action->addItem(QString::fromStdString(a.identifier));
}
clearKeybindingFields();
clearActionFields();
......
......@@ -102,7 +102,10 @@ void AdditionalScriptsDialog::parseScript() {
void AdditionalScriptsDialog::chooseScripts() {
ScriptlogDialog d(this);
connect(&d, &ScriptlogDialog::scriptsSelected, this, &AdditionalScriptsDialog::appendScriptsToTextfield);
connect(
&d, &ScriptlogDialog::scriptsSelected,
this, &AdditionalScriptsDialog::appendScriptsToTextfield
);
d.exec();
}
......
......@@ -120,7 +120,7 @@ void HorizonsDialog::typeOnChange(int index) {
}
}
void HorizonsDialog::downloadProgress(qint64 value, qint64 total) {
void HorizonsDialog::downloadProgress(int value, int total) {
if (total < 0) {
_downloadProgress->setRange(0, 0);
return;
......
......@@ -23,15 +23,21 @@
****************************************************************************************/
#include "profile/scriptlogdialog.h"
#include "profile/line.h"
#include <openspace/engine/configuration.h>
#include <openspace/engine/globals.h>
#include <openspace/scene/profile.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/fmt.h>
#include <QGridLayout>
#include <QDialogButtonBox>
#include <QLabel>
#include <QLineEdit>
#include <QListWidget>
#include <QFile>
#include <QPushButton>
#include <QTextStream>
#include <QVBoxLayout>
ScriptlogDialog::ScriptlogDialog(QWidget* parent)
: QDialog(parent)
......@@ -39,32 +45,52 @@ ScriptlogDialog::ScriptlogDialog(QWidget* parent)
setWindowTitle("Scriptlog");
createWidgets();
QFile file(QString::fromStdString(absPath("${LOGS}/scriptLog.txt").string()));
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file);
while (!in.atEnd()) {
QString line = in.readLine();
// removing return from a few statments
// these are usually generated by gui panels
line.remove(QRegularExpression("^return "));
if (!line.isEmpty()) {
_scriptlogList->addItem(line);
}
}
}
loadScriptFile();
}
void ScriptlogDialog::createWidgets() {
QBoxLayout* layout = new QVBoxLayout(this);
// Column 0 Column 1
// *-------------------------*------------*
// | Title |
// *--------------------------------------*
// | Filter scripts * Reload |
// *--------------------------------------*
// | Script list |
// *--------------------------------------*
// * Save Cancel *
// *-------------------------*------------*
QGridLayout* layout = new QGridLayout;
{
QLabel* heading = new QLabel("Choose commands from log/scriptLog.txt");
QLabel* heading = new QLabel(QString::fromStdString(
fmt::format(
"Choose commands from \"{}\"",
openspace::global::configuration->scriptLog
)
));
heading->setObjectName("heading");
layout->addWidget(heading);
layout->addWidget(heading, 0, 0, 1, 2);
}
_filter = new QLineEdit;
_filter->setPlaceholderText("Filter the list of scripts");
connect(
_filter, &QLineEdit::textEdited,
this, &ScriptlogDialog::updateScriptList
);
layout->addWidget(_filter, 1, 0);
_reloadFile = new QPushButton("Reload");
_reloadFile->setToolTip("Reload the script log file");
connect(
_reloadFile, &QPushButton::clicked,
this, &ScriptlogDialog::loadScriptFile
);
layout->addWidget(_reloadFile, 1, 1);
_scriptlogList = new QListWidget;
_scriptlogList->setSelectionMode(QAbstractItemView::SelectionMode::MultiSelection);
layout->addWidget(_scriptlogList);
layout->addWidget(_scriptlogList, 2, 0, 1, 2);
layout->addWidget(new Line);
{
......@@ -78,8 +104,48 @@ void ScriptlogDialog::createWidgets() {
buttons, &QDialogButtonBox::rejected,
this, &ScriptlogDialog::reject
);
layout->addWidget(buttons);
layout->addWidget(buttons, 3, 0, 1, 2);
}
setLayout(layout);
}
void ScriptlogDialog::loadScriptFile() {
std::string log = absPath(openspace::global::configuration->scriptLog).string();
QFile file(QString::fromStdString(log));
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file);
while (!in.atEnd()) {
QString line = in.readLine();
// removing return from a few statments
// these are usually generated by gui panels
line.remove(QRegularExpression("^return "));
if (!line.isEmpty()) {
_scripts.push_back(line.toStdString());
}
}
}
updateScriptList();
}
void ScriptlogDialog::updateScriptList() {
std::string filter = _filter->text().toStdString();
QListWidgetItem* curr = _scriptlogList->currentItem();
std::string selection;
if (curr) {
selection = curr->text().toStdString();
}
int index = -1;
_scriptlogList->clear();
for (const std::string& script : _scripts) {
if (script.find(filter) != std::string::npos) {
if (script == selection && index == -1) {
index = _scriptlogList->count();
}
_scriptlogList->addItem(QString::fromStdString(script));
}
}
_scriptlogList->setCurrentRow(index != -1 ? index : 0);
}
void ScriptlogDialog::saveChosenScripts() {
......
......@@ -202,16 +202,12 @@ ProjectionOptions FileSupport::saveProjectionNoSpout(
projection.tilt = 0.f;
return projection;
}
break;
case WindowControl::ProjectionIndeces::SphericalMirror:
{
sgct::config::SphericalMirrorProjection projection;
projection.quality = winControl->qualitySelectedValue();
return projection;
}
break;
case WindowControl::ProjectionIndeces::Cylindrical:
{
sgct::config::CylindricalProjection projection;
......@@ -219,16 +215,12 @@ ProjectionOptions FileSupport::saveProjectionNoSpout(
projection.heightOffset = winControl->heightOffset();
return projection;
}
break;
case WindowControl::ProjectionIndeces::Equirectangular:
{
sgct::config::EquirectangularProjection projection;
projection.quality = winControl->qualitySelectedValue();
return projection;
}
break;
case WindowControl::ProjectionIndeces::Planar:
default:
{
......@@ -240,7 +232,6 @@ ProjectionOptions FileSupport::saveProjectionNoSpout(
projection.fov.down = -projection.fov.up;
return projection;
}
break;
}
}
......
......@@ -52,8 +52,8 @@ void SgctEdit::systemMonitorConfiguration(const QList<QScreen*>& screenList) {
_monitorSizeList.push_back({
screenList[s]->availableGeometry().x(),
screenList[s]->availableGeometry().y(),
actualWidth,
actualHeight
static_cast<int>(actualWidth * screenList[s]->devicePixelRatio()),
static_cast<int>(actualHeight * screenList[s]->devicePixelRatio())
});
}
_nMaxWindows = (_monitorSizeList.size() == 1) ? 3 : 4;
......
Subproject commit 7ced19201b8b2fe4ceba94f178464d4fac3867a1
Subproject commit 0d2b7558c5275fe531322e56c465074c2e9b8f9f
Subproject commit 6fca5e588297d70f81588f2d086918ede4e8ebc4
Subproject commit b791897e556fa91c101352de3a8bef33970f12fc
......@@ -81,7 +81,7 @@ public:
std::string substringReplacement;
ScriptSubstringReplace(std::string found, std::string replace)
: substringFound(found)
, substringReplacement(replace) {};
, substringReplacement(replace) {}
};
static const size_t FileHeaderVersionLength = 5;
......@@ -858,7 +858,7 @@ public:
_script.erase();
_script = temp.data();
};
}
};
protected:
......
......@@ -115,7 +115,7 @@ struct CameraKeyframe {
reinterpret_cast<const char*>(&_timestamp),
reinterpret_cast<const char*>(&_timestamp) + sizeof(_timestamp)
);
};
}
size_t deserialize(const std::vector<char>& buffer, size_t offset = 0) {
int size = 0;
......@@ -155,7 +155,7 @@ struct CameraKeyframe {
offset += size;
return offset;
};
}
void write(std::ostream& out) const {
out.write(
......@@ -184,7 +184,7 @@ struct CameraKeyframe {
// Write timestamp
out.write(reinterpret_cast<const char*>(&_timestamp), sizeof(_timestamp));
};
}
void write(std::stringstream& out) const {
// Add camera position
......@@ -206,7 +206,7 @@ struct CameraKeyframe {
out << "- ";
}
out << _focusNode;
};
}
void read(std::istream* in) {
// Read position
......@@ -234,7 +234,7 @@ struct CameraKeyframe {
// Read timestamp
in->read(reinterpret_cast<char*>(&_timestamp), sizeof(_timestamp));
};
}
void read(std::istringstream& iss) {
std::string rotationFollowing;
......@@ -250,7 +250,7 @@ struct CameraKeyframe {
>> rotationFollowing
>> _focusNode;
_followNodeRotation = (rotationFollowing == "F");
};
}
};
struct TimeKeyframe {
......@@ -271,17 +271,17 @@ struct TimeKeyframe {
reinterpret_cast<const char*>(this),
reinterpret_cast<const char*>(this) + sizeof(TimeKeyframe)
);
};
}
size_t deserialize(const std::vector<char>& buffer, size_t offset = 0) {
*this = *reinterpret_cast<const TimeKeyframe*>(buffer.data() + offset);
offset += sizeof(TimeKeyframe);
return offset;
};
}
void write(std::ostream* out) const {
out->write(reinterpret_cast<const char*>(this), sizeof(TimeKeyframe));
};
}
void write(std::stringstream& out) const {
out << ' ' << _dt;
......@@ -297,11 +297,11 @@ struct TimeKeyframe {
else {
out << " -";
}
};
}
void read(std::istream* in) {
in->read(reinterpret_cast<char*>(this), sizeof(TimeKeyframe));
};
}
void read(std::istringstream& iss) {
std::string paused, jump;
......@@ -311,7 +311,7 @@ struct TimeKeyframe {
>> jump;
_paused = (paused == "P");
_requiresTimeJump = (jump == "J");
};
}
};
struct TimeTimeline {
......@@ -339,7 +339,7 @@ struct TimeTimeline {
for (const TimeKeyframe& k : _keyframes) {
k.serialize(buffer);
}
};
}
size_t deserialize(const std::vector<char>& buffer, size_t offset = 0) {
int size = 0;
......@@ -358,7 +358,7 @@ struct TimeTimeline {
offset = k.deserialize(buffer, offset);
}
return offset;
};
}
void write(std::ostream* out) const {
out->write(reinterpret_cast<const char*>(&_clear), sizeof(bool));
......@@ -368,7 +368,7 @@ struct TimeTimeline {
for (const TimeKeyframe& k : _keyframes) {
k.write(out);
}
};
}
void read(std::istream* in) {
in->read(reinterpret_cast<char*>(&_clear), sizeof(bool));
......@@ -378,7 +378,7 @@ struct TimeTimeline {
for (TimeKeyframe& k : _keyframes) {
k.read(in);
}
};
}
};
struct ScriptMessage {
......@@ -386,7 +386,7 @@ struct ScriptMessage {
ScriptMessage(const std::vector<char>& buffer) {
deserialize(buffer);
}
virtual ~ScriptMessage() {};
virtual ~ScriptMessage() {}
std::string _script;
double _timestamp = 0.0;
......@@ -398,7 +398,7 @@ struct ScriptMessage {
buffer.insert(buffer.end(), p, p + sizeof(uint32_t));
buffer.insert(buffer.end(), _script.begin(), _script.end());
};
}
void deserialize(const std::vector<char>& buffer) {
const char* p = buffer.data();
......@@ -417,11 +417,11 @@ struct ScriptMessage {
// We can skip over the first uint32_t that encoded the length
_script.assign(buffer.begin() + sizeof(uint32_t), buffer.end());
};
}
void write(std::ostream* out) const {
out->write(_script.c_str(), _script.size());
};
}
void write(unsigned char* buf, size_t& idx, std::ofstream& file) const {
size_t strLen = _script.size();
......@@ -436,7 +436,7 @@ struct ScriptMessage {
file.write(reinterpret_cast<char*>(buf), idx);
//Write directly to file because some scripts can be very long
file.write(_script.c_str(), _script.size());
};
}
void write(std::stringstream& ss) const {
unsigned int numLinesInScript = static_cast<unsigned int>(
......@@ -457,7 +457,7 @@ struct ScriptMessage {
_script.erase();
_script = temp.data();
};
}
void read(std::istringstream& iss) {
int numScriptLines;
......@@ -476,7 +476,7 @@ struct ScriptMessage {
_script.append("\n");
}
}
};
}
};
} // namespace openspace::messagestructures
......
......@@ -45,11 +45,11 @@ public:
virtual void preRaycast(const RenderData& /*renderData*/,
const DeferredcastData& /*deferredData*/,
ghoul::opengl::ProgramObject& /*program*/) {};
ghoul::opengl::ProgramObject& /*program*/) {}
virtual void postRaycast(const RenderData& /*renderData*/,
const DeferredcastData& /*deferredData*/,
ghoul::opengl::ProgramObject& /*program*/) {};
ghoul::opengl::ProgramObject& /*program*/) {}
virtual std::filesystem::path deferredcastVSPath() const = 0;
......
......@@ -67,9 +67,9 @@ private:
};
struct MappingKey {
MappingKey(float p, const glm::vec4& c): position(p), color(c) {};
MappingKey(float p): position(p), color(glm::vec4(0.f)) {};
bool operator<(const MappingKey& rhs) {return position < rhs.position;};
MappingKey(float p, const glm::vec4& c): position(p), color(c) {}
MappingKey(float p): position(p), color(glm::vec4(0.f)) {}
bool operator<(const MappingKey& rhs) { return position < rhs.position; }
float position = 0.f;
glm::vec4 color = glm::vec4(0.f);
......
......@@ -43,10 +43,10 @@ protected:
// from the used of implementations of the interface
friend class SyncEngine;
virtual void preSync(bool /*isMaster*/) {};
virtual void preSync(bool /*isMaster*/) {}
virtual void encode(SyncBuffer* /*syncBuffer*/) = 0;
virtual void decode(SyncBuffer* /*syncBuffer*/) = 0;
virtual void postSync(bool /*isMaster*/) {};
virtual void postSync(bool /*isMaster*/) {}
};
} // namespace openspace
......
......@@ -39,7 +39,6 @@
#include <ghoul/opengl/programobject.h>
namespace {
constexpr const char* _loggerCat = "RenderableNodeLine";
constexpr const char* ProgramName = "NodeLineProgram";
constexpr const char* Root = "Root";
......
......@@ -70,8 +70,8 @@ protected:
void createPlane();
properties::OptionProperty _blendMode;
properties::BoolProperty _mirrorBackside;
properties::BoolProperty _billboard;
properties::BoolProperty _mirrorBackside;
properties::FloatProperty _size;
properties::Vec3Property _multiplyColor;
......
......@@ -208,6 +208,8 @@ void RenderablePlaneTimeVaryingImage::update(const UpdateData& data) {
if (isInInterval) {
const size_t nextIdx = _activeTriggerTimeIndex + 1;
if (
// true => we were not in an interval the previous frame but now we are
_activeTriggerTimeIndex == -1 ||
// true => We stepped back to a time represented by another state
currentTime < _startTimes[_activeTriggerTimeIndex] ||
// true => We stepped forward to a time represented by another state
......
......@@ -359,7 +359,7 @@ void RenderablePoints::readColorMapFile() {
// std::streampos position = file.tellg();
std::getline(file, line);
if (line[0] == '#' || line.empty()) {
if (line.empty() || line[0] == '#') {
continue;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment