示例#1
0
bool DownloadPage::OnEnter(bool forward)
{
	txtFinish->Hide();
	//disable forward and backward buttons
	setControlEnable(wizard, wxID_FORWARD, false);
	setControlEnable(wizard, wxID_BACKWARD, false);

	// fill in version information
	wxString fromVersion = conv(CONFIG->readVersionInfo());
	wxString toVersion   = conv(CONFIG->getOnlineVersion());
	wxString versionText = wxString::Format(_("updating from %s to %s"), fromVersion, toVersion);
	
	if(fromVersion == wxT("unknown"))
		versionText = toVersion;
	if(fromVersion == toVersion)
		versionText = toVersion;
	std::string versionURL  = std::string(CHANGELOGURL) + toVersion;
	hlink->SetLabel(versionText);
	hlink->SetURL(conv(versionURL));

    htmlinfo->LoadPage(wxT("http://api.rigsofrods.com/didyouknow/"));

	if(!CONFIG->getUserPathExists())
	{

		startThreadUserContent();
	} else
	{
		startThread();
	}
	return true;
}
示例#2
0
bool LastPage::OnEnter(bool forward)
{
	setControlEnable(wizard, wxID_BACKWARD, false);
	setControlEnable(wizard, wxID_CANCEL, false);

	if(CONFIG->installType == wxString("fixuserpath"))
		return true;

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
	chk_configurator->SetValue(true);
	if(CONFIG->getPersistentConfig(wxT("updater.run_configurator")) == wxT("no"))
		chk_configurator->SetValue(false);

	chk_changelog->SetValue(true);
	if(CONFIG->getPersistentConfig(wxT("updater.view_changelog")) == wxT("no"))
		chk_changelog->SetValue(false);

#endif // OGRE_PLATFORM
	return true;
}
void MusicEqualizerDialog::setEqEnable()
{
    m_eable = !m_eable;
    emit setEnaleEffect(m_eable);
    ui->showEqButton->setIcon(QIcon(!m_eable ? ":/equalizer/off" : ":/equalizer/on"));

    setControlEnable(!m_eable);
    if(m_eable)
    {
        emitParameter();
    }
}
void MusicEqualizerDialog::setEqEnable()
{
    m_eable = !m_eable;
    emit setEnaleEffect(m_eable);
    m_ui->showEqButton->setStyleSheet(!m_eable ? MusicUIObject::MKGEqualizerOff : MusicUIObject::MKGEqualizerOn);

    setControlEnable(m_eable);
    if(m_eable)
    {
        emitParameter();
    }
}
MusicEqualizerDialog::MusicEqualizerDialog(QWidget *parent)
    : MusicAbstractMoveDialog(parent),
      m_ui(new Ui::MusicEqualizerDialog)
{
    m_ui->setupUi(this);

    m_ui->topTitleCloseButton->setIcon(QIcon(":/functions/btn_close_hover"));
    m_ui->topTitleCloseButton->setStyleSheet(MusicUIObject::MToolButtonStyle04);
    m_ui->topTitleCloseButton->setCursor(QCursor(Qt::PointingHandCursor));
    m_ui->topTitleCloseButton->setToolTip(tr("Close"));
    connect(m_ui->topTitleCloseButton, SIGNAL(clicked()), SLOT(close()));

    m_eable = false;
    m_eqChoiceSelected = false;

    init();

    m_ui->eqChoice->setItemDelegate(new QStyledItemDelegate(m_ui->eqChoice));
    m_ui->eqChoice->setStyleSheet(MusicUIObject::MComboBoxStyle01 + MusicUIObject::MItemView01);
    m_ui->eqChoice->view()->setStyleSheet(MusicUIObject::MScrollBarStyle01);
    m_ui->eqChoice->addItems(QStringList() << tr("Custom") << tr("Default") << tr("Classical")
                  << tr("Club") << tr("Dance") << tr("Bass") << tr("Soprano") << tr("BassSoprano")
                  << tr("Headset") << tr("Hall") << tr("Scene") << tr("Pop") << tr("Repaglinide")
                  << tr("Party") << tr("Rock") << tr("Oscar") << tr("Mild") << tr("SoftRock")
                  << tr("Electronics"));
    connect(m_ui->eqChoice, SIGNAL(currentIndexChanged(int)), SLOT(eqChoiceIndexChanged(int)));

    m_ui->showEqButton->setStyleSheet(MusicUIObject::MKGEqualizerOff);

#ifdef Q_OS_UNIX
    m_ui->showEqButton->setFocusPolicy(Qt::NoFocus);
    m_ui->resetButton->setFocusPolicy(Qt::NoFocus);
#endif

    setControlEnable(false);
    initEqualizeValue();
    readEqInformation();

    M_CONNECTION_PTR->setValue(getClassName(), this);
    M_CONNECTION_PTR->poolConnect(getClassName(), MusicPlayer::getClassName());
    M_CONNECTION_PTR->poolConnect(getClassName(), MusicSoundEffectsWidget::getClassName());
}
示例#6
0
void TimingTaskDlg::onBtnOk()
{
	bool isOk = false;	
	if (isBtnChecked(m_hRadioFixTime))
	{
		isOk = onFixTimeTask();
	}
	else
	{
		isOk = onCountDownTask();
	}
	if (!isOk)
	{
		MessageBox(m_hWnd, "格式不对", "格式不对", MB_OK);
	}
	else
	{
		setControlEnable(false);
	}
}
MusicEqualizerDialog::MusicEqualizerDialog(QWidget *parent)
    : MusicAbstractMoveDialog(parent),
      ui(new Ui::MusicEqualizerDialog)
{
    ui->setupUi(this);

    ui->topTitleCloseButton->setIcon(QIcon(":/share/searchclosed"));
    ui->topTitleCloseButton->setStyleSheet(MusicUIObject::MToolButtonStyle03);
    ui->topTitleCloseButton->setCursor(QCursor(Qt::PointingHandCursor));
    ui->topTitleCloseButton->setToolTip(tr("Close"));
    connect(ui->topTitleCloseButton, SIGNAL(clicked()), SLOT(close()));

    m_eable = false;
    m_eqChoiceSelected = false;

    init();

    ui->eqChoice->setItemDelegate(new QStyledItemDelegate(ui->eqChoice));
    ui->eqChoice->setStyleSheet(MusicUIObject::MComboBoxStyle01 + MusicUIObject::MItemView01);
    ui->eqChoice->view()->setStyleSheet(MusicUIObject::MScrollBarStyle01);
    ui->eqChoice->addItems(QStringList() << tr("Custom") << tr("Default") << tr("Classical")
                  << tr("Club") << tr("Dance") << tr("Bass") << tr("Soprano") << tr("BassSoprano")
                  << tr("Headset") << tr("Hall") << tr("Scene") << tr("Pop") << tr("Repaglinide")
                  << tr("Party") << tr("Rock") << tr("Oscar") << tr("Mild") << tr("SoftRock")
                  << tr("Electronics"));
    connect(ui->eqChoice, SIGNAL(currentIndexChanged(int)), SLOT(eqChoiceIndexChanged(int)));

    ui->showEqButton->setIcon(QIcon(":/equalizer/off"));

    initEqualizeValue();
    readEqInformation();
    setControlEnable(false);

    M_CONNECTION->setValue("MusicEqualizerDialog", this);
    M_CONNECTION->poolConnect("MusicEqualizerDialog", "MusicPlayer");
}
示例#8
0
void TimingTaskDlg::resetState()
{
	KillTimer(m_hWnd, kTimerId_refresh);
	m_tasking = false;
	setControlEnable(true);
}
示例#9
0
void DownloadPage::OnStatusUpdate(MyStatusEvent &ev)
{
	switch(ev.GetId())
	{
	case MSE_STARTING:
	case MSE_UPDATE_TEXT:
		statusList->Append(ev.GetString());
		statusList->SetSelection(statusList->GetCount()-1);
		break;
	case MSE_UPDATE_PROGRESS:
		progress->SetValue(ev.GetProgress() * 1000.0f);
		break;
	case MSE_DOWNLOAD_PROGRESS:
	{
		wxString str = ev.GetString();
		if(ev.GetProgress() > 0)
		{
			for(int i=statusList->GetCount()-1;i>=0;--i)
			{
				wxString str_comp = statusList->GetString(i).SubString(0, str.size()-1);
				if(str_comp == str)
				{
					statusList->SetString(i, str + wxString::Format(wxT(" (%3.1f%% downloaded)"), ev.GetProgress() * 100.0f));
					break;
				}
			}
		}
	}
		break;
	case MSE_DOWNLOAD_DONE:
	{
		wxString str = ev.GetString();
		for(int i=statusList->GetCount()-1;i>=0;--i)
		{
			wxString str_comp = statusList->GetString(i).SubString(0, str.size()-1);
			if(str_comp == str)
			{
				statusList->SetString(i, str + wxT(" (DONE)"));
				break;
			}
		}
	}
		break;
	case MSE_ERROR:
		statusList->Append(_("error: ") + ev.GetString());
		statusList->SetSelection(statusList->GetCount()-1);
		progress->SetValue(1000);
		wxMessageBox(ev.GetString(), _("Error"), wxICON_ERROR | wxOK, this);
		break;
	case MSE_UPDATE_TIME:
		//txt_dltime->SetLabel(ev.GetString());
		break;
	case MSE_UPDATE_TIME_LEFT:
		txt_remaintime->SetLabel(ev.GetString());
		break;
	case MSE_UPDATE_SPEED:
		txt_speed->SetLabel(ev.GetString());
		break;
	case MSE_UPDATE_TRAFFIC:
		txt_traf->SetLabel(ev.GetString());
		break;
	case MSE_UPDATE_PATH:
		txt_localpath->SetLabel(ev.GetString());
		break;
	case MSE_UPDATE_SERVER:
		txt_server->SetLabel(ev.GetString());
		break;
	case MSE_UPDATE_CONCURR:
		txt_concurr->SetLabel(ev.GetString());
		break;
	case MSE_UPDATE_TITLE:
		txtTitle->SetLabel(ev.GetString());
		break;
	case MSE_DONE:
		// normal end
		statusList->Append(wxT("Finished downloading."));
		statusList->SetSelection(statusList->GetCount()-1);
		progress->SetValue(1000);
		txt_remaintime->SetLabel(wxT("finished!"));
		isDone=true;

		// enableforward button
		txtFinish->Show();
        htmlinfo->Hide();
		setControlEnable(wizard, wxID_FORWARD, true);
		break;
	}
}
示例#10
0
// ----------------------------------------------------------------------------
// Wizard pages
// ----------------------------------------------------------------------------
//// PresentationPage
PresentationPage::PresentationPage(wxWizard *parent, bool enforceUpdate) : wxWizardPageSimple(parent)
{

	wxString a = conv(CONFIG->readVersionInfo());
	CONFIG->getCurrentVersionInfo();
	wxString b = conv(CONFIG->getOnlineVersion());


	m_bitmap = wxBitmap(welcome_xpm);
	wxBoxSizer *mainSizer = new wxBoxSizer(wxVERTICAL);
	wxStaticText *tst;
	//GetParent()->SetBackgroundColour(*wxWHITE);
	mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Welcome to the online updater of Rigs of Rods\n")), 0, wxALL, 5);
	wxFont dfont=tst->GetFont();
	dfont.SetWeight(wxFONTWEIGHT_BOLD);
	dfont.SetPointSize(dfont.GetPointSize()+4);
	tst->SetFont(dfont);
	tst->Wrap(TXTWRAP);
	mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("This program will help you update Rigs of Rods on your computer.\n")), 0, wxALL, 5);
	tst->Wrap(TXTWRAP);
	mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Before updating, make sure Rigs of Rods is not running, and that your internet connection is available.\n")), 0, wxALL, 5);
	tst->Wrap(TXTWRAP);
	mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("If you are using a firewall, please allow this program to access the Internet.\n")), 0, wxALL, 5);
	tst->Wrap(TXTWRAP);

	if(CONFIG->installType == wxString("fixuserpath"))
	{
		// need to restore user path
		mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Your user path is not existing, please click next to restore it and try to update again after the restore.")), 0, wxALL, 5);
		dfont=tst->GetFont();
		dfont.SetWeight(wxFONTWEIGHT_BOLD);
		dfont.SetPointSize(dfont.GetPointSize()+4);
		tst->SetFont(dfont);
		tst->Wrap(TXTWRAP);

		LOG("[FIXUSERPATH_MODE]\n");
		setControlEnable(parent, wxID_FORWARD, true);
		setControlEnable(parent, wxID_BACKWARD, false);
	} else
	{
		// now: compare the versions
		mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Installed Version: ") + a), 0, wxALL, 5);
		dfont=tst->GetFont();
		dfont.SetWeight(wxFONTWEIGHT_BOLD);
		dfont.SetPointSize(dfont.GetPointSize()+4);
		tst->SetFont(dfont);
		tst->Wrap(TXTWRAP);

		mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Online Version: ") + b), 0, wxALL, 5);
		dfont=tst->GetFont();
		dfont.SetWeight(wxFONTWEIGHT_BOLD);
		dfont.SetPointSize(dfont.GetPointSize()+4);
		tst->SetFont(dfont);
		tst->Wrap(TXTWRAP);

		Version installed_version(conv(a));
		Version online_version(conv(b));

		LOG("INSTALLED VERSION: '%s'\n", conv(a).c_str());
		LOG("ONLINE VERSION:    '%s'\n", conv(b).c_str());

		if (installed_version < online_version)
		{
			// new version
			mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Click on Next to continue.\n")), 0, wxALL, 5);
			tst->Wrap(TXTWRAP);
			LOG("install choice: new version available\n");
		} else if (online_version < installed_version)
		{
			// local newer
			mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Your version is newer than the last public version, no need to update")), 0, wxALL, 5);
			dfont=tst->GetFont();
			dfont.SetWeight(wxFONTWEIGHT_BOLD);
			dfont.SetPointSize(dfont.GetPointSize()+4);
			tst->SetFont(dfont);
			tst->Wrap(TXTWRAP);

			setControlEnable(parent, wxID_FORWARD, false);
			setControlEnable(parent, wxID_BACKWARD, false);
			LOG("install choice: using newer version than public\n");
		} else
		{
			// no need to update
			mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Already up to date, no need to update")), 0, wxALL, 5);
			dfont=tst->GetFont();
			dfont.SetWeight(wxFONTWEIGHT_BOLD);
			dfont.SetPointSize(dfont.GetPointSize()+4);
			tst->SetFont(dfont);
			tst->Wrap(TXTWRAP);

			setControlEnable(parent, wxID_FORWARD, false);
			setControlEnable(parent, wxID_BACKWARD, false);
			LOG("install choice: version recent, no need to update\n");
		}

		if(enforceUpdate)
		{
			mainSizer->Add(tst=new wxStaticText(this, wxID_ANY, _T("Update was enforced")), 0, wxALL, 5);
			dfont=tst->GetFont();
			dfont.SetWeight(wxFONTWEIGHT_BOLD);
			dfont.SetPointSize(dfont.GetPointSize()+4);
			tst->SetFont(dfont);
			tst->Wrap(TXTWRAP);

			setControlEnable(parent, wxID_FORWARD, true);
			setControlEnable(parent, wxID_BACKWARD, true);
			LOG("[UPDATE ENFORCED]\n");
		}
	}

	SetSizer(mainSizer);
	mainSizer->Fit(this);
}