mirror of
https://github.com/Lurkki14/tuxclocker.git
synced 2024-11-24 09:10:16 -06:00
interface/qt: remove AssignableEditor
This commit is contained in:
parent
74a218d10a
commit
de8e42db81
@ -13,6 +13,7 @@ foreach lib : nvidia_linux_libs
|
||||
endif
|
||||
endforeach
|
||||
|
||||
|
||||
if all_nvidia_linux_libs
|
||||
shared_library('nvidia', 'nvidia_linux.c',
|
||||
include_directories : incdir,
|
||||
|
@ -1,59 +0,0 @@
|
||||
#include "AssignableEditor.h"
|
||||
#include "IntRangeEditor.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
AssignableEditor::AssignableEditor(QWidget *parent) : QWidget(parent) {
|
||||
m_mainLayout = new QGridLayout;
|
||||
|
||||
m_title = new QLabel;
|
||||
m_title->setText("Select an editable node to edit it.");
|
||||
m_mainLayout->addWidget(m_title);
|
||||
|
||||
m_editorStackedWidget = new QStackedWidget;
|
||||
|
||||
m_noneEditor = new QWidget;
|
||||
m_intRangeEditor = new IntRangeEditor;
|
||||
m_enumEditor = new EnumEditor;
|
||||
|
||||
m_editorStackedWidget->addWidget(m_noneEditor);
|
||||
m_editorStackedWidget->addWidget(m_intRangeEditor);
|
||||
m_editorStackedWidget->addWidget(m_enumEditor);
|
||||
|
||||
m_editorStackedWidget->setCurrentWidget(m_noneEditor);
|
||||
m_mainLayout->addWidget(m_editorStackedWidget);
|
||||
|
||||
setLayout(m_mainLayout);
|
||||
}
|
||||
|
||||
AssignableEditor::~AssignableEditor() {
|
||||
}
|
||||
|
||||
void AssignableEditor::setData(const QVariant& data) {
|
||||
|
||||
m_assignableData = qvariant_cast<AssignableData>(data);
|
||||
|
||||
// Change the title
|
||||
m_title->setText(m_assignableData.name);
|
||||
|
||||
QStringList optList;
|
||||
// Switch to the correct subeditor
|
||||
switch (m_assignableData.m_valueCategory) {
|
||||
case TC_ASSIGNABLE_RANGE:
|
||||
m_intRangeEditor->setRange(m_assignableData.m_rangeInfo.int_range);
|
||||
m_editorStackedWidget->setCurrentWidget(m_intRangeEditor);
|
||||
break;
|
||||
case TC_ASSIGNABLE_ENUM:
|
||||
// Convert properties member to QStringList
|
||||
for (uint16_t i = 0; i < m_assignableData.m_enumInfo.property_count; i++) {
|
||||
QString opt(m_assignableData.m_enumInfo.properties[i]);
|
||||
optList.append(opt);
|
||||
}
|
||||
m_enumEditor->setData(optList);
|
||||
m_editorStackedWidget->setCurrentWidget(m_enumEditor);
|
||||
break;
|
||||
default:
|
||||
m_editorStackedWidget->setCurrentWidget(m_noneEditor);
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <AssignableData.h>
|
||||
#include "IntRangeEditor.h"
|
||||
#include "EnumEditor.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLayout>
|
||||
#include <QSlider>
|
||||
#include <QLabel>
|
||||
#include <QSpinBox>
|
||||
#include <QStackedWidget>
|
||||
|
||||
class AssignableEditor : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AssignableEditor(QWidget *parent = nullptr);
|
||||
~AssignableEditor();
|
||||
// Set the data for the editor
|
||||
void setData(const QVariant &data);
|
||||
private:
|
||||
AssignableData m_assignableData;
|
||||
|
||||
QGridLayout *m_mainLayout;
|
||||
QLabel *m_title;
|
||||
// Contains the node specific widgets
|
||||
QStackedWidget *m_editorStackedWidget;
|
||||
|
||||
// Different widgets for editing different types of nodes
|
||||
// Empty widget
|
||||
QWidget *m_noneEditor;
|
||||
IntRangeEditor *m_intRangeEditor;
|
||||
EnumEditor *m_enumEditor;
|
||||
};
|
Loading…
Reference in New Issue
Block a user