Setting up removing and adding stuff to the settings window dirlistview
This commit is contained in:
parent
e768ae9af8
commit
0372a4ad8c
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>358</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -359,6 +359,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="7" colspan="2">
|
||||||
|
<widget class="QCheckBox" name="checkHeadlight">
|
||||||
|
<property name="text">
|
||||||
|
<string>Headlight</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4" colspan="3">
|
||||||
|
<widget class="QRadioButton" name="radioPointLight">
|
||||||
|
<property name="text">
|
||||||
|
<string>Point light</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="2">
|
||||||
<widget class="QSlider" name="light_R_S">
|
<widget class="QSlider" name="light_R_S">
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
|
@ -466,20 +480,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="7" colspan="2">
|
|
||||||
<widget class="QCheckBox" name="checkHeadlight">
|
|
||||||
<property name="text">
|
|
||||||
<string>Headlight</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="4" colspan="3">
|
|
||||||
<widget class="QRadioButton" name="radioPointLight">
|
|
||||||
<property name="text">
|
|
||||||
<string>Point light</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -489,6 +489,16 @@
|
||||||
<string>General</string>
|
<string>General</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
|
<item row="3" column="1" colspan="3">
|
||||||
|
<widget class="QListView" name="dirListView"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="3">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Directory Drop Down List:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="1" column="3">
|
<item row="1" column="3">
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -532,22 +542,23 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QPushButton" name="addItem">
|
||||||
|
<property name="text">
|
||||||
|
<string>+</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2">
|
||||||
|
<widget class="QPushButton" name="removeItem">
|
||||||
|
<property name="text">
|
||||||
|
<string>--</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
|
|
|
@ -29,7 +29,7 @@ private:
|
||||||
bool m_bfCulling = false;
|
bool m_bfCulling = false;
|
||||||
bool m_light = false;
|
bool m_light = false;
|
||||||
|
|
||||||
QString listOfDirs;
|
QString listOfDirs;
|
||||||
int m_lightType = 1; // 1 = direct, 2 = point
|
int m_lightType = 1; // 1 = direct, 2 = point
|
||||||
QVector3D m_lightColor = { 255,255,255 };
|
QVector3D m_lightColor = { 255,255,255 };
|
||||||
float m_attenuation = 0.0f;
|
float m_attenuation = 0.0f;
|
||||||
|
@ -48,7 +48,9 @@ public:
|
||||||
bool isBfCulling() const;
|
bool isBfCulling() const;
|
||||||
bool isLight() const;
|
bool isLight() const;
|
||||||
|
|
||||||
QString getListOfDirs();
|
QString getListOfDirs();
|
||||||
|
void setListOfDirs(QString);
|
||||||
|
|
||||||
int getLightType() const;
|
int getLightType() const;
|
||||||
QVector3D getLightColor() const;
|
QVector3D getLightColor() const;
|
||||||
float getAttenuation() const;
|
float getAttenuation() const;
|
||||||
|
|
|
@ -18,6 +18,9 @@ private:
|
||||||
|
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString dirList;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void autoColorToggled();
|
void autoColorToggled();
|
||||||
void radioToggled();
|
void radioToggled();
|
||||||
|
@ -25,6 +28,9 @@ private slots:
|
||||||
void backgroundColorOnChanged();
|
void backgroundColorOnChanged();
|
||||||
void lightColorChanged();
|
void lightColorChanged();
|
||||||
|
|
||||||
|
void on_addItem_clicked();
|
||||||
|
void on_removeItem_clicked();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updateBGColorOff(QVector3D value);
|
void updateBGColorOff(QVector3D value);
|
||||||
void updateBGColorOn(QVector3D value);
|
void updateBGColorOn(QVector3D value);
|
||||||
|
|
|
@ -35,19 +35,19 @@ void SettingsManager::readFromFile()
|
||||||
QList<QByteArray> lines = stream.split('\n');
|
QList<QByteArray> lines = stream.split('\n');
|
||||||
|
|
||||||
for (auto& it : lines)
|
for (auto& it : lines)
|
||||||
{
|
{
|
||||||
if (it.startsWith("<qkList>"))
|
if (it.startsWith("<qkList>"))
|
||||||
{
|
{
|
||||||
QList<QByteArray> values = it.right(it.size() - it.indexOf('>') - 1).split(';');
|
QList<QByteArray> values = it.right(it.size() - it.indexOf('>') - 1).split(';');
|
||||||
for (int i = 0; i < values.size(); i++)
|
for (int i = 0; i < values.size(); i++)
|
||||||
{
|
{
|
||||||
if (i == values.size() - 1)
|
if (i == values.size() - 1)
|
||||||
listOfDirs.append(values[i]);
|
listOfDirs.append(values[i]);
|
||||||
else
|
else
|
||||||
listOfDirs.append(values[i] + ";");
|
listOfDirs.append(values[i] + ";");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (it.startsWith("<bgOn>"))
|
else if (it.startsWith("<bgOn>"))
|
||||||
{
|
{
|
||||||
QList<QByteArray> values = it.right(it.size() - it.indexOf('>') - 1).split(';');
|
QList<QByteArray> values = it.right(it.size() - it.indexOf('>') - 1).split(';');
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ void SettingsManager::writeToFile()
|
||||||
file.write(QString("<liTy>%1\n").arg(m_lightType).toUtf8());
|
file.write(QString("<liTy>%1\n").arg(m_lightType).toUtf8());
|
||||||
file.write(QString("<atFa>%1\n").arg(m_attenuation).toUtf8());
|
file.write(QString("<atFa>%1\n").arg(m_attenuation).toUtf8());
|
||||||
file.write(QString("<amCo>%1\n").arg(m_ambient).toUtf8());
|
file.write(QString("<amCo>%1\n").arg(m_ambient).toUtf8());
|
||||||
file.write(QString("<qkList>%1\n").arg(listOfDirs).toUtf8());
|
file.write(QString("<qkList>%1\n").arg(listOfDirs).toUtf8());
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
}
|
}
|
||||||
|
@ -127,9 +127,15 @@ void SettingsManager::writeToFile()
|
||||||
|
|
||||||
QString SettingsManager::getListOfDirs()
|
QString SettingsManager::getListOfDirs()
|
||||||
{
|
{
|
||||||
return listOfDirs;
|
return listOfDirs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsManager::setListOfDirs(QString newDirSet)
|
||||||
|
{
|
||||||
|
listOfDirs = newDirSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QVector3D SettingsManager::getBgColorOn() const
|
QVector3D SettingsManager::getBgColorOn() const
|
||||||
{
|
{
|
||||||
return m_bgColorOn;
|
return m_bgColorOn;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "..\Header\SettingsWindow.h"
|
#include "..\Header\SettingsWindow.h"
|
||||||
#include "..\Header\SettingsManager.h"
|
#include "..\Header\SettingsManager.h"
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// constructor/destructor
|
// constructor/destructor
|
||||||
|
@ -65,9 +65,11 @@ SettingsWindow::~SettingsWindow()
|
||||||
|
|
||||||
QString SettingsWindow::getDirList()
|
QString SettingsWindow::getDirList()
|
||||||
{
|
{
|
||||||
return SettingsManager::getInstance()->getListOfDirs();
|
dirList = SettingsManager::getInstance()->getListOfDirs();
|
||||||
}
|
|
||||||
|
|
||||||
|
// ui->dirListView->
|
||||||
|
return dirList;
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsWindow::setupConnections()
|
void SettingsWindow::setupConnections()
|
||||||
{
|
{
|
||||||
|
@ -187,3 +189,18 @@ void SettingsWindow::lightColorChanged()
|
||||||
ui->lightOn_B_S->setValue((int)(ui->light_B_S->value() / 50));
|
ui->lightOn_B_S->setValue((int)(ui->light_B_S->value() / 50));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsWindow::on_addItem_clicked()
|
||||||
|
{
|
||||||
|
QString dirName = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home",
|
||||||
|
QFileDialog::ShowDirsOnly |
|
||||||
|
QFileDialog::DontResolveSymlinks);
|
||||||
|
// ui->dirListView-> selectionModel()->
|
||||||
|
// ui->dirListView->model()->insertRow(dirName) ; //->insertRow(dirName);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsWindow::on_removeItem_clicked()
|
||||||
|
{
|
||||||
|
ui->dirListView->selectionModel()->selectedIndexes();
|
||||||
|
// ui->dirListView->model()->removeRow(ui->dirListView->selectionModel()->selectedIndexes());
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue