Setting up removing and adding stuff to the settings window dirlistview

This commit is contained in:
Maxim Stewart 2017-05-31 03:09:20 -05:00
parent e768ae9af8
commit 0372a4ad8c
5 changed files with 90 additions and 48 deletions

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>358</height>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
@ -359,6 +359,20 @@
</property>
</widget>
</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">
<widget class="QSlider" name="light_R_S">
<property name="maximum">
@ -466,20 +480,6 @@
</property>
</widget>
</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>
</widget>
</item>
@ -489,6 +489,16 @@
<string>General</string>
</property>
<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">
<spacer name="horizontalSpacer">
<property name="orientation">
@ -532,21 +542,22 @@
</property>
</widget>
</item>
</layout>
<item row="4" column="1">
<widget class="QPushButton" name="addItem">
<property name="text">
<string>+</string>
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="4" column="2">
<widget class="QPushButton" name="removeItem">
<property name="text">
<string>--</string>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>

View File

@ -49,6 +49,8 @@ public:
bool isLight() const;
QString getListOfDirs();
void setListOfDirs(QString);
int getLightType() const;
QVector3D getLightColor() const;
float getAttenuation() const;

View File

@ -18,6 +18,9 @@ private:
void setupConnections();
private:
QString dirList;
private slots:
void autoColorToggled();
void radioToggled();
@ -25,6 +28,9 @@ private slots:
void backgroundColorOnChanged();
void lightColorChanged();
void on_addItem_clicked();
void on_removeItem_clicked();
signals:
void updateBGColorOff(QVector3D value);
void updateBGColorOn(QVector3D value);

View File

@ -130,6 +130,12 @@ QString SettingsManager::getListOfDirs()
return listOfDirs;
}
void SettingsManager::setListOfDirs(QString newDirSet)
{
listOfDirs = newDirSet;
}
QVector3D SettingsManager::getBgColorOn() const
{
return m_bgColorOn;

View File

@ -1,6 +1,6 @@
#include "..\Header\SettingsWindow.h"
#include "..\Header\SettingsManager.h"
#include <QFileDialog>
/////////////////////////////////////////////////////////////////////////
// constructor/destructor
@ -65,9 +65,11 @@ SettingsWindow::~SettingsWindow()
QString SettingsWindow::getDirList()
{
return SettingsManager::getInstance()->getListOfDirs();
}
dirList = SettingsManager::getInstance()->getListOfDirs();
// ui->dirListView->
return dirList;
}
void SettingsWindow::setupConnections()
{
@ -187,3 +189,18 @@ void SettingsWindow::lightColorChanged()
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());
}