SettingsDialog::SettingsDialog(QWidget* parent, int flags) 
	: BaseWindow(OnlyCloseButton, NoResize, parent)
	, m_propertyMapper(new SettingsPropertyMapper(this))
	, editRssRule(NULL)
	, deleteRssRule(NULL)
{
	setupUi(this);
	previousFocuse = NULL;
	settings = QApplicationSettings::getInstance();
	rcon = RconWebService::getInstance();
	tracker = TorrentTracker::getInstance();
	FillDTTab();
	FillRestrictionTab();
	FillFilteringGroups();
	FillGeneralTab();
	FillHDDTab();
	FillWebUITab();
	SetupSchedullerTab();
	FillKeyMapTab();
	FillNetworkTab();
	FillRssTab();
	setupCustomWindow();
	QPushButton* applyButton = buttonBox->button(QDialogButtonBox::Apply);
	if (applyButton != NULL)
	{
		applyButton->setEnabled(false);
	}
	setupWindowIcons();
	
	StyleEngene* style = StyleEngene::getInstance();
	connect(style, SIGNAL(styleChanged()), this, SLOT(setupWindowIcons()));
	connect(m_propertyMapper.get(), SIGNAL(GotChanges()), SLOT(EnableApplyButton()));
	connect(m_propertyMapper.get(), SIGNAL(NoChanges()), SLOT(DisableApplyButton()));
}
ReportProblemDialog::ReportProblemDialog(QWidget* parent) 
	: BaseWindow<QDialog>(OnlyCloseButton, NoResize, parent)
	, m_pNetManager(new QNetworkAccessManager(this))
{
	setupUi(this);
	setupCustomWindow();
	setupWindowIcons();
	emailEdit->setValidator(new EmailValidator(this));
	connect(m_pNetManager, SIGNAL(finished(QNetworkReply*)), SLOT(OnFinished(QNetworkReply*)));
}
InitializationDialog::InitializationDialog(QWidget* parent)
	: BaseWindow<QDialog>(MinimizeModeOff, NoResize, parent)
	  , Ui::InitializationDialog()

{
	m_pInitThread = new QThread;
	m_pWorker = new InitializationWorker();
	setupUi(this);
	setupCustomWindow();
	setupWindowIcons();
	pbClose->setEnabled(false);
	m_pWorker->moveToThread(m_pInitThread);
	connect(m_pInitThread, SIGNAL(started()), m_pWorker, SLOT(PeformInit()));
	connect(m_pWorker, SIGNAL(progress(int, QString)), SLOT(onProgressChanged(int, QString)), Qt::QueuedConnection);
	connect(m_pWorker, SIGNAL(finished()), m_pInitThread, SLOT(quit()));
	connect(m_pWorker, SIGNAL(finished()), m_pWorker, SLOT(deleteLater()));
	connect(m_pInitThread, SIGNAL(finished()), m_pInitThread, SLOT(deleteLater()));
	connect(m_pInitThread, SIGNAL(finished()), SLOT(close()));
}