Set ability to fill listWidget in SettingsWindow with saved dir list from SettingsManager.

This commit is contained in:
Maxim Stewart 2017-06-15 23:28:47 -05:00
parent d908894265
commit 1e71ebed47

View File

@ -20,6 +20,14 @@ SettingsWindow::SettingsWindow(QWidget * parent)
// set default values
SettingsManager* sm = SettingsManager::getInstance(this);
// set dirList for passing to Main and then fill settings manager dir list window
dirList = sm->getListOfDirs();
QStringList values;
values = dirList.split(';');
for (int i = 0; i < values.size(); i++) {
ui->dirListWidget->insertItem(0,values[i]);
}
ui->lightOff_R_SB->setValue((int)(sm->getBgColorOff()[0]));
ui->lightOff_G_SB->setValue((int)(sm->getBgColorOff()[1]));
ui->lightOff_B_SB->setValue((int)(sm->getBgColorOff()[2]));
@ -67,9 +75,6 @@ SettingsWindow::~SettingsWindow()
QString SettingsWindow::getDirList()
{
dirList = SettingsManager::getInstance()->getListOfDirs();
// ui->dirListView->
return dirList;
}
@ -197,10 +202,10 @@ void SettingsWindow::on_addItem_clicked()
QString dirName = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home",
QFileDialog::ShowDirsOnly |
QFileDialog::DontResolveSymlinks);
ui->dirListWidget->insertItem(0,dirName);
ui->dirListWidget->insertItem(0,dirName);
}
void SettingsWindow::on_removeItem_clicked()
{
qDeleteAll(ui->dirListWidget->selectedItems());
qDeleteAll(ui->dirListWidget->selectedItems());
}