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()));
}
Example #2
0
BOOL    CProfileAssociationPage::OnCommand(WORD wNotifyCode, WORD wid, HWND hwndControl) {

    switch (wid) {

        case AddButton :
            if  (wNotifyCode == BN_CLICKED) {
                CAddDeviceDialog cadd(this, m_hwnd);
                if (!cadd.bCanceled()) {
                    UpdateDeviceListBox();
                    EnableApplyButton();
                    SettingChanged(TRUE);
                }
                return  TRUE;
            }
            break;

        case RemoveButton :
            if  (wNotifyCode == BN_CLICKED) {
                LRESULT i = SendDlgItemMessage(m_hwnd, DeviceListControl,
                    LB_GETCURSEL, 0, 0);

                if  (i == -1)
                    return  TRUE;

                unsigned uItem = (unsigned)SendDlgItemMessage(m_hwnd, DeviceListControl,
                    LB_GETITEMDATA, i, 0);
                Dissociate(uItem);
                UpdateDeviceListBox();
                EnableApplyButton();
                SettingChanged(TRUE);
                return  TRUE;
            }
            break;

        case DeviceListControl :
            if (wNotifyCode == LBN_SELCHANGE) {
                EnableWindow(GetDlgItem(m_hwnd, RemoveButton),
                    -1 != SendDlgItemMessage(m_hwnd, DeviceListControl, LB_GETCURSEL, 0, 0));
                return  TRUE;
            }
            break;
    }

    return TRUE;
}