/***************************************************************************
* Copyright (C) 2009-2012 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <QTextCodec>
#include <QSettings>
#include <QCheckBox>
#include <QComboBox>
#include <QMenu>
#include <QHeaderView>
#include <QApplication>
#include <QDesktopServices>
#include <qmmp/qmmp.h>
#include <qmmpui/filedialog.h>
#include "fileops.h"
#include "hotkeydialog.h"
#include "settingsdialog.h"
SettingsDialog::SettingsDialog(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
ui.tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
ui.tableWidget->verticalHeader()->hide();
ui.tableWidget->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
connect (ui.newButton,SIGNAL(pressed()), SLOT(createAction()));
connect (ui.deleteButton,SIGNAL(pressed()), SLOT(deleteAction()));
QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
settings.beginGroup("FileOps");
int count = settings.value("count", 0).toInt();
for (int i = 0; i < count; ++i)
{
ui.tableWidget->insertRow (i);
QCheckBox *checkBox = new QCheckBox;
checkBox->setFocusPolicy (Qt::NoFocus);
QComboBox *comboBox = new QComboBox;
comboBox->addItem (tr("Copy"), FileOps::COPY);
comboBox->addItem (tr("Rename"), FileOps::RENAME);
//comboBox->addItem (tr("Move"), FileOps::MOVE);
comboBox->addItem (tr("Remove"), FileOps::REMOVE);
comboBox->setFocusPolicy (Qt::NoFocus);
checkBox->setChecked(settings.value(QString("enabled_%1").arg(i), true).toBool());