Exemple #1
0
/**
 * Initializes all the elements in the Equip Craft screen.
 * @param game Pointer to the core game.
 * @param base Pointer to the base to get info from.
 */
CraftsState::CraftsState(Base *base) : _base(base)
{
	// Create objects
	_window = new Window(this, 320, 200, 0, 0);
	_btnOk = new TextButton(288, 16, 16, 176);
	_txtTitle = new Text(298, 17, 16, 8);
	_txtBase = new Text(298, 17, 16, 24);
	_txtName = new Text(94, 9, 16, 40);
	_txtStatus = new Text(50, 9, 110, 40);
	_txtWeapon = new Text(50, 17, 160, 40);
	_txtCrew = new Text(58, 9, 210, 40);
	_txtHwp = new Text(46, 9, 268, 40);
	_lstCrafts = new TextList(288, 118, 8, 58);

	// Set palette
	setPalette("PAL_BASESCAPE", 3);

	add(_window);
	add(_btnOk);
	add(_txtTitle);
	add(_txtBase);
	add(_txtName);
	add(_txtStatus);
	add(_txtWeapon);
	add(_txtCrew);
	add(_txtHwp);
	add(_lstCrafts);

	centerAllSurfaces();

	// Set up objects
	_window->setColor(Palette::blockOffset(15)+1);
	_window->setBackground(_game->getResourcePack()->getSurface("BACK14.SCR"));

	_btnOk->setColor(Palette::blockOffset(13)+10);
	_btnOk->setText(tr("STR_OK"));
	_btnOk->onMouseClick((ActionHandler)&CraftsState::btnOkClick);
	_btnOk->onKeyboardPress((ActionHandler)&CraftsState::btnOkClick, Options::keyCancel);

	_txtTitle->setColor(Palette::blockOffset(15)+1);
	_txtTitle->setBig();
	_txtTitle->setText(tr("STR_INTERCEPTION_CRAFT"));

	_txtBase->setColor(Palette::blockOffset(15)+1);
	_txtBase->setBig();
	_txtBase->setText(tr("STR_BASE_").arg(_base->getName()));

	_txtName->setColor(Palette::blockOffset(15)+1);
	_txtName->setText(tr("STR_NAME_UC"));

	_txtStatus->setColor(Palette::blockOffset(15)+1);
	_txtStatus->setText(tr("STR_STATUS"));

	_txtWeapon->setColor(Palette::blockOffset(15)+1);
	_txtWeapon->setText(tr("STR_WEAPON_SYSTEMS"));
	_txtWeapon->setWordWrap(true);

	_txtCrew->setColor(Palette::blockOffset(15)+1);
	_txtCrew->setText(tr("STR_CREW"));

	_txtHwp->setColor(Palette::blockOffset(15)+1);
	_txtHwp->setText(tr("STR_HWPS"));

	_lstCrafts->setColor(Palette::blockOffset(13)+10);
	_lstCrafts->setArrowColor(Palette::blockOffset(15)+1);
	_lstCrafts->setColumns(5, 94, 68, 44, 46, 28);
	_lstCrafts->setSelectable(true);
	_lstCrafts->setBackground(_window);
	_lstCrafts->setMargin(8);
	_lstCrafts->onMouseClick((ActionHandler)&CraftsState::lstCraftsClick);
}
Exemple #2
0
void ComponentDock::setupHTools() {
	htools = new QFrame(this);
	auto vlayout = new QVBoxLayout(htools);
	vlayout->setMargin(2);
	vlayout->setSpacing(0);

	auto hlayoutTitle = new QHBoxLayout();
	hlabel = new QLabel(htools);
	hlabel->setText("Components Editor ");
	hlabel->setStyleSheet("color: lightGray;");
	hlayoutTitle->addWidget(hlabel);

	auto sepBrush = QBrush(Qt::gray, Qt::BrushStyle::Dense6Pattern);
	QPalette sepPalette;
	sepPalette.setBrush(QPalette::Background, sepBrush);

	auto seprator = new QLabel(htools);
	seprator->setAutoFillBackground(true);
	seprator->setPalette(sepPalette);
	seprator->setMaximumHeight(10);
	hlayoutTitle->addWidget(seprator, 1, Qt::AlignBottom);

	auto btnClose = new QToolButton(htools);
	btnClose->setText("X");
	btnClose->setStyleSheet("color: lightGray\n");
	btnClose->setAutoRaise(true);
	btnClose->setMaximumWidth(16);
	btnClose->setMaximumHeight(16);
	hlayoutTitle->addWidget(btnClose);
	connect(btnClose, &QToolButton::clicked, this, &QDockWidget::hide);

	vlayout->addLayout(hlayoutTitle);

	auto hlayout = new QHBoxLayout(htools);
	hlayout->setMargin(0);

	auto btnAddComps = new QToolButton(htools);
	btnAddComps->setMenu(mtypes);
	btnAddComps->setDefaultAction(addDefComp);
	btnAddComps->setIcon(QIcon(":/icons/add"));
	btnAddComps->setPopupMode(QToolButton::MenuButtonPopup);
	btnAddComps->setToolButtonStyle(Qt::ToolButtonIconOnly);
	hlayout->addWidget(btnAddComps);

	hlayout->addStretch(1);

	// lua table name
	llabel = new QLabel(htools);
	hlayout->addWidget(llabel);

	vlayout->addLayout(hlayout);

	auto hlayout2 = new QHBoxLayout(htools);
	hlayout2->setMargin(0);

	auto lblLayer = new QLabel(this);
	lblLayer->setText("Layer: ");
	hlayout2->addWidget(lblLayer);

	spnLayer = new QSpinBox(this);
	spnLayer->setMinimum(0);
	spnLayer->setMaximum(KENTITY_LAYER_SIZE);
	connect(spnLayer, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &ComponentDock::layerChanged);
	hlayout2->addWidget(spnLayer, 1);
	hlayout2->addSpacing(5);

	auto lblOrder = new QLabel(this);
	lblOrder->setText("Z: ");
	hlayout2->addWidget(lblOrder);

	spnZOrder = new QSpinBox(this);
	spnZOrder->setMinimum(0);
	spnZOrder->setMaximum(9999999);
	spnZOrder->setValue(0);
	connect(spnZOrder, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &ComponentDock::zorderChanged);
	hlayout2->addWidget(spnZOrder, 1);
	hlayout2->addSpacing(5);

	// static
	chkStatic = new QCheckBox(this);
	chkStatic->setText("Static");
	connect(chkStatic, &QCheckBox::stateChanged, this, &ComponentDock::staticChanged);
	hlayout2->addWidget(chkStatic);
	hlayout2->addSpacing(5);

	vlayout->addLayout(hlayout2);

	auto hlayout3 = new QHBoxLayout(htools);
	hlayout3->setMargin(0);
	hlayout3->setSpacing(0);

	auto btnCollpaseAll = new QToolButton(htools);
	btnCollpaseAll->setIcon(QIcon(":/icons/col"));
	btnCollpaseAll->setToolButtonStyle(Qt::ToolButtonIconOnly);
	connect(btnCollpaseAll, &QToolButton::clicked, comTree, &QTreeWidget::collapseAll);
	hlayout3->addWidget(btnCollpaseAll);

	hlayout3->addSpacing(5);

	ledit = new QLineEdit(htools);
	ledit->setPlaceholderText("Search");
	ledit->addAction(QIcon(":/icons/search"), QLineEdit::ActionPosition::TrailingPosition);
	ledit->setStyleSheet("background-color: gray;");
	connect(ledit, &QLineEdit::textChanged, this, &ComponentDock::actSearch);
	hlayout3->addWidget(ledit, 1);

	vlayout->addLayout(hlayout3);

	htools->setLayout(vlayout);
	setTitleBarWidget(htools);
}
Exemple #3
0
Drawable::Drawable(DirectDrawWriter &writer) :
    isOK(false), isOverlay(false), paused(false),
    writer(writer),
    flip(0),
    DDraw(NULL), DDClipper(NULL), DDSPrimary(NULL), DDSSecondary(NULL), DDSBackBuffer(NULL), DDrawColorCtrl(NULL),
    DwmEnableComposition(NULL)
{
    setMouseTracking(true);
    grabGesture(Qt::PinchGesture);
    if (DirectDrawCreate(NULL, &DDraw, NULL) == DD_OK && DDraw->SetCooperativeLevel(NULL, DDSCL_NORMAL) == DD_OK)
    {
        DDSURFACEDESC ddsd_primary = {sizeof ddsd_primary};
        ddsd_primary.dwFlags = DDSD_CAPS;
        ddsd_primary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
        if (DDraw->CreateSurface(&ddsd_primary, &DDSPrimary, NULL) == DD_OK)
        {
            LPDIRECTDRAWSURFACE DDrawTestSurface;
            DDSURFACEDESC ddsd_test = {sizeof ddsd_test};
            ddsd_test.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PIXELFORMAT;
            ddsd_test.dwWidth  = 8;
            ddsd_test.dwHeight = 2;
            ddsd_test.ddpfPixelFormat.dwSize = sizeof ddsd_test.ddpfPixelFormat;
            ddsd_test.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
            ddsd_test.ddpfPixelFormat.dwFourCC = MAKEFOURCC('Y', 'V', '1', '2');

            /* Overlay YV12 test */
            if (QSysInfo::windowsVersion() <= QSysInfo::WV_6_1) //Windows 8 and 10 can't disable DWM, so overlay won't work
            {
                DDCAPS ddCaps = {sizeof ddCaps};
                DDraw->GetCaps(&ddCaps, NULL);
                if (ddCaps.dwCaps & (DDCAPS_OVERLAY | DDCAPS_OVERLAYFOURCC | DDCAPS_OVERLAYSTRETCH))
                {
                    ddsd_test.ddsCaps.dwCaps = DDSCAPS_OVERLAY | DDSCAPS_VIDEOMEMORY;
                    if (DDraw->CreateSurface(&ddsd_test, &DDrawTestSurface, NULL) == DD_OK)
                    {
                        RECT destRect = {0, 0, 1, 1};
                        HRESULT res = DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, &destRect, DDOVER_SHOW, NULL);
                        if (res == DDERR_OUTOFCAPS && QSysInfo::windowsVersion() >= QSysInfo::WV_6_0)
                        {
                            /* Disable DWM to use overlay */
                            DwmEnableComposition = (DwmEnableCompositionProc)GetProcAddress(GetModuleHandleA("dwmapi.dll"), "DwmEnableComposition");
                            if (DwmEnableComposition)
                            {
                                if (DwmEnableComposition(DWM_EC_DISABLECOMPOSITION) == S_OK)
                                    res = DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, &destRect, DDOVER_SHOW, NULL);
                                else
                                    DwmEnableComposition = NULL;
                            }
                        }
                        if (res == DD_OK)
                        {
                            DDrawTestSurface->UpdateOverlay(NULL, DDSPrimary, NULL, DDOVER_HIDE, NULL);

                            setAutoFillBackground(true);
                            setPalette(QColor(ColorKEY));
                            connect(&QMPlay2Core, SIGNAL(videoDockMoved()), this, SLOT(updateOverlay()));
                            connect(&QMPlay2Core, SIGNAL(videoDockVisible(bool)), this, SLOT(overlayVisible(bool)));
                            connect(&visibleTim, SIGNAL(timeout()), this, SLOT(doOverlayVisible()));
                            visibleTim.setSingleShot(true);

                            isOK = isOverlay = true;
                        }
	ArticleStateVehicle::ArticleStateVehicle(ArticleDefinitionVehicle *defs) : ArticleState(defs->id)
	{
		Unit *unit = _game->getRuleset()->getUnit(defs->id);
		Armor *armor = _game->getRuleset()->getArmor(unit->getArmor());
		RuleItem *item = _game->getRuleset()->getItem(defs->id);

		// add screen elements
		_txtTitle = new Text(310, 17, 5, 23);
		_txtInfo = new Text(300, 150, 10, 122);
		_lstStats = new TextList(300, 89, 10, 48);

		// Set palette
		setPalette("PAL_UFOPAEDIA");

		ArticleState::initLayout();

		// add other elements
		add(_txtTitle);
		add(_txtInfo);
		add(_lstStats);

		// Set up objects
		_game->getResourcePack()->getSurface("BACK10.SCR")->blit(_bg);
		_btnOk->setColor(Palette::blockOffset(5));
		_btnPrev->setColor(Palette::blockOffset(5));
		_btnNext->setColor(Palette::blockOffset(5));

		_txtTitle->setColor(Palette::blockOffset(15)+4);
		_txtTitle->setBig();
		_txtTitle->setText(tr(defs->title));

		_txtInfo->setColor(Palette::blockOffset(15)-1);
		_txtInfo->setWordWrap(true);
		_txtInfo->setText(tr(defs->text));

		_lstStats->setColor(Palette::blockOffset(15)+4);
		_lstStats->setColumns(2, 175, 145);
		_lstStats->setDot(true);
		
		std::wostringstream ss;
		ss << unit->getStats()->tu;
		_lstStats->addRow(2, tr("STR_TIME_UNITS").c_str(), ss.str().c_str());
		
		std::wostringstream ss2;
		ss2 << unit->getStats()->health;
		_lstStats->addRow(2, tr("STR_HEALTH").c_str(), ss2.str().c_str());
		
		std::wostringstream ss3;
		ss3 << armor->getFrontArmor();
		_lstStats->addRow(2, tr("STR_FRONT_ARMOR").c_str(), ss3.str().c_str());
		
		std::wostringstream ss4;
		ss4 << armor->getSideArmor();
		_lstStats->addRow(2, tr("STR_LEFT_ARMOR").c_str(), ss4.str().c_str());
		
		std::wostringstream ss5;
		ss5 << armor->getSideArmor();
		_lstStats->addRow(2, tr("STR_RIGHT_ARMOR").c_str(), ss5.str().c_str());
		
		std::wostringstream ss6;
		ss6 << armor->getRearArmor();
		_lstStats->addRow(2, tr("STR_REAR_ARMOR").c_str(), ss6.str().c_str());
		
		std::wostringstream ss7;
		ss7 << armor->getUnderArmor();
		_lstStats->addRow(2, tr("STR_UNDER_ARMOR").c_str(), ss7.str().c_str());
		
		_lstStats->addRow(2, tr("STR_WEAPON").c_str(), tr(defs->weapon).c_str());
				
		if (!item->getCompatibleAmmo()->empty())
		{
			RuleItem *ammo = _game->getRuleset()->getItem(item->getCompatibleAmmo()->front());

			std::wostringstream ss8;
			ss8 << ammo->getPower();
			_lstStats->addRow(2, tr("STR_WEAPON_POWER").c_str(), ss8.str().c_str());

			_lstStats->addRow(2, tr("STR_AMMUNITION").c_str(), tr(ammo->getName()).c_str());
			
			std::wostringstream ss9;
			ss9 << item->getClipSize();
			_lstStats->addRow(2, tr("STR_ROUNDS").c_str(), ss9.str().c_str());
			
			_txtInfo->setY(138);
		}
		else
		{
			std::wostringstream ss8;
			ss8 << item->getPower();
			_lstStats->addRow(2, tr("STR_WEAPON_POWER").c_str(), ss8.str().c_str());
		}
		centerAllSurfaces();
	}
 void QAbstractConfigurableTileWidget::leaveEvent(QEvent * event) {
   setPalette(actualPalette);
   update();
   entered = false;
 }
Exemple #6
0
void Console::setBaseColor(QColor c) {
    QPalette p = palette();
    p.setColor(QPalette::Base, c);
    setPalette(p);
}
Exemple #7
0
sfxrInstrumentView::sfxrInstrumentView( Instrument * _instrument,
                                        QWidget * _parent ) :
    InstrumentView( _instrument, _parent )
{
    srand(time(NULL));
    setAutoFillBackground( true );
    QPalette pal;
    pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) );
    setPalette( pal );

    createKnob(m_attKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*0, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*0, "Attack Time");
    createKnob(m_holdKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*1, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*0, "Sustain Time");
    createKnob(m_susKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*2, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*0, "Sustain Punch");
    createKnob(m_decKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*3, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*0, "Decay Time");

    m_attKnob	->setObjectName( "envKnob" );
    m_holdKnob	->setObjectName( "envKnob" );
    m_susKnob	->setObjectName( "envKnob" );
    m_decKnob	->setObjectName( "envKnob" );

    createKnob(m_startFreqKnob,	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*0, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*1, "Start Frequency");
    createKnob(m_minFreqKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*1, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*1, "Min Frequency");
    createKnob(m_slideKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*2, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*1, "Slide");
    createKnob(m_dSlideKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*3, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*1, "Delta Slide");
    createKnob(m_vibDepthKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*4, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*1, "Vibrato Depth");
    createKnob(m_vibSpeedKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*5, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*1, "Vibrato Speed");

    m_startFreqKnob	->setObjectName( "freqKnob" );
    m_minFreqKnob	->setObjectName( "freqKnob" );
    m_slideKnob		->setObjectName( "freqKnob" );
    m_dSlideKnob	->setObjectName( "freqKnob" );
    m_vibDepthKnob	->setObjectName( "freqKnob" );
    m_vibSpeedKnob	->setObjectName( "freqKnob" );

    createKnob(m_changeAmtKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*0, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*2, "Change Amount");
    createKnob(m_changeSpeedKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*1, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*2, "Change Speed");

    m_changeAmtKnob		->setObjectName( "changeKnob" );
    m_changeSpeedKnob	->setObjectName( "changeKnob" );

    createKnob(m_sqrDutyKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*3, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*2, "Square Duty (Square wave only)");
    createKnob(m_sqrSweepKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*4, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*2, "Duty Sweep (Square wave only)");

    m_sqrDutyKnob	->setObjectName( "sqrKnob" );
    m_sqrSweepKnob	->setObjectName( "sqrKnob" );

    createKnob(m_repeatSpeedKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*0, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*3, "Repeat Speed");

    m_repeatSpeedKnob	->setObjectName( "repeatKnob" );

    createKnob(m_phaserOffsetKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*3, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*3, "Phaser Offset");
    createKnob(m_phaserSweepKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*4, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*3, "Phaser Sweep");

    m_phaserOffsetKnob	->setObjectName( "phaserKnob" );
    m_phaserSweepKnob	->setObjectName( "phaserKnob" );

    createKnob(m_lpFilCutKnob,		KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*0, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*4, "LP Filter Cutoff");
    createKnob(m_lpFilCutSweepKnob, KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*1, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*4, "LP Filter Cutoff Sweep");
    createKnob(m_lpFilResoKnob, 	KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*2, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*4, "LP Filter Resonance");
    createKnob(m_hpFilCutKnob,		KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*3, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*4, "HP Filter Cutoff");
    createKnob(m_hpFilCutSweepKnob, KNOBS_BASE_X+KNOB_BLOCK_SIZE_X*4, KNOBS_BASE_Y+KNOB_BLOCK_SIZE_Y*4, "HP Filter Cutoff Sweep");

    m_lpFilCutKnob		->setObjectName( "filterKnob" );
    m_lpFilCutSweepKnob	->setObjectName( "filterKnob" );
    m_lpFilResoKnob		->setObjectName( "filterKnob" );
    m_hpFilCutKnob		->setObjectName( "filterKnob" );
    m_hpFilCutSweepKnob	->setObjectName( "filterKnob" );

    createButtonLocalGraphic(m_sqrWaveBtn,		KNOBS_BASE_X+WAVEFORM_BUTTON_WIDTH*0, WAVEFORM_BASE_Y, "Square Wave", "sfxr_square_wave");
    createButtonLocalGraphic(m_sawWaveBtn,		KNOBS_BASE_X+WAVEFORM_BUTTON_WIDTH*1, WAVEFORM_BASE_Y, "Saw Wave", "sfxr_saw_wave");
    createButtonLocalGraphic(m_sinWaveBtn,		KNOBS_BASE_X+WAVEFORM_BUTTON_WIDTH*2, WAVEFORM_BASE_Y, "Sine Wave", "sfxr_sin_wave");
    createButtonLocalGraphic(m_noiseWaveBtn,	KNOBS_BASE_X+WAVEFORM_BUTTON_WIDTH*3, WAVEFORM_BASE_Y, "Noise", "sfxr_white_noise_wave");

    m_waveBtnGroup = new automatableButtonGroup( this );
    m_waveBtnGroup->addButton(m_sqrWaveBtn);
    m_waveBtnGroup->addButton(m_sawWaveBtn);
    m_waveBtnGroup->addButton(m_sinWaveBtn);
    m_waveBtnGroup->addButton(m_noiseWaveBtn);


    createButtonLocalGraphic(m_pickupBtn,		GENERATOR_BASE_X+GENERATOR_BUTTON_WIDTH*0, GENERATOR_BASE_Y, "Generate pick up/coin sfx", "pickup");
    createButtonLocalGraphic(m_laserBtn,		GENERATOR_BASE_X+GENERATOR_BUTTON_WIDTH*1, GENERATOR_BASE_Y, "Generate laser/shoot sfx", "laser");
    createButtonLocalGraphic(m_explosionBtn,	GENERATOR_BASE_X+GENERATOR_BUTTON_WIDTH*2, GENERATOR_BASE_Y, "Generate explosion sfx", "explosion");
    createButtonLocalGraphic(m_powerupBtn,		GENERATOR_BASE_X+GENERATOR_BUTTON_WIDTH*3, GENERATOR_BASE_Y, "Generate power up sfx", "powerup");
    createButtonLocalGraphic(m_hitBtn,			GENERATOR_BASE_X+GENERATOR_BUTTON_WIDTH*4, GENERATOR_BASE_Y, "Generate hit/hurt sfx", "hit");
    createButtonLocalGraphic(m_jumpBtn,			GENERATOR_BASE_X+GENERATOR_BUTTON_WIDTH*5, GENERATOR_BASE_Y, "Generate jump sfx", "jump");
    createButtonLocalGraphic(m_blipBtn,			GENERATOR_BASE_X+GENERATOR_BUTTON_WIDTH*6, GENERATOR_BASE_Y, "Generate blip/select sfx", "blip");
    connect( m_pickupBtn, SIGNAL ( clicked() ), this, SLOT ( genPickup() ) );
    connect( m_laserBtn, SIGNAL ( clicked() ), this, SLOT ( genLaser() ) );
    connect( m_explosionBtn, SIGNAL ( clicked() ), this, SLOT ( genExplosion() ) );
    connect( m_powerupBtn, SIGNAL ( clicked() ), this, SLOT ( genPowerup() ) );
    connect( m_hitBtn, SIGNAL ( clicked() ), this, SLOT ( genHit() ) );
    connect( m_jumpBtn, SIGNAL ( clicked() ), this, SLOT ( genJump() ) );
    connect( m_blipBtn, SIGNAL ( clicked() ), this, SLOT ( genBlip() ) );


    createButtonLocalGraphic(m_randomizeBtn,	RAND_BUTTON_X, RAND_BUTTON_Y, "Generate random sfx", "randomize");
    createButtonLocalGraphic(m_mutateBtn,		MUTA_BUTTON_X, MUTA_BUTTON_Y, "Mutate sfx", "mutate");
    connect( m_randomizeBtn, SIGNAL ( clicked() ), this, SLOT ( randomize() ) );
    connect( m_mutateBtn, SIGNAL ( clicked() ), this, SLOT ( mutate() ) );


    //preview sound on generator/random/mutate button clicked
    /*  // disabled for now
    	connect( m_pickupBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    	connect( m_laserBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    	connect( m_explosionBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    	connect( m_powerupBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    	connect( m_hitBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    	connect( m_jumpBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    	connect( m_blipBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    	connect( m_randomizeBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    	connect( m_mutateBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) );
    */
}
Exemple #8
0
bool DrasculaEngine::runCurrentChapter() {
	int n;

	rightMouseButton = 0;

	previousMusic = -1;

	if (currentChapter != 2) {
		int soc = 0;
		for (n = 0; n < 6; n++) {
			soc = soc + CHARACTER_WIDTH;
			_frameX[n] = soc;
		}
	}

	for (n = 1; n < ARRAYSIZE(inventoryObjects); n++)
		inventoryObjects[n] = 0;

	for (n = 0; n < NUM_FLAGS; n++)
		flags[n] = 0;

	if (currentChapter == 2) {
		flags[16] = 1;
		flags[17] = 1;
		flags[27] = 1;
	}

	for (n = 1; n < 7; n++)
		inventoryObjects[n] = n;

	if (currentChapter == 1) {
		pickObject(28);

		if (loadedDifferentChapter == 0)
			animation_1_1();

		selectVerb(kVerbNone);
		loadPic("2aux62.alg", drawSurface2);
		trackProtagonist = 1;
		objExit = 104;
		if (loadedDifferentChapter != 0) {
			if (!loadGame(saveName)) {
				return true;
			}
		} else {
			enterRoom(62);
			curX = -20;
			curY = 56;
			gotoObject(65, 145);
		}
	} else if (currentChapter == 2) {
		addObject(kItemPhone);
		trackProtagonist = 3;
		objExit = 162;
		if (loadedDifferentChapter == 0)
			enterRoom(14);
		else {
			if (!loadGame(saveName)) {
				return true;
			}
		}
	} else if (currentChapter == 3) {
		addObject(kItemPhone);
		addObject(kItemEarplugs);
		addObject(kItemSickle);
		addObject(kItemHandbag);
		addObject(kItemCross);
		addObject(kItemReefer);
		addObject(kItemOneCoin);
		flags[1] = 1;
		trackProtagonist = 1;
		objExit = 99;
		if (loadedDifferentChapter == 0)
			enterRoom(20);
		else {
			if (!loadGame(saveName)) {
				return true;
			}
		}
	// From here onwards the items have different IDs
	} else if (currentChapter == 4) {
		addObject(kItemPhone2);
		addObject(kItemCross2);
		addObject(kItemReefer2);
		addObject(kItemOneCoin2);
		objExit = 100;
		if (loadedDifferentChapter == 0) {
			enterRoom(21);
			trackProtagonist = 0;
			curX = 235;
			curY = 164;
		} else {
			if (!loadGame(saveName)) {
				return true;
			}
		}
	} else if (currentChapter == 5) {
		addObject(28);
		addObject(7);
		addObject(9);
		addObject(11);
		addObject(13);
		addObject(14);
		addObject(15);
		addObject(17);
		addObject(20);
		trackProtagonist = 1;
		objExit = 100;
		if (loadedDifferentChapter == 0) {
			enterRoom(45);
		} else {
			if (!loadGame(saveName)) {
				return true;
			}
		}
	} else if (currentChapter == 6) {
		addObject(28);
		addObject(9);

		trackProtagonist = 1;
		objExit = 104;
		if (loadedDifferentChapter == 0) {
			enterRoom(58);
			animation_1_6();
		} else {
			if (!loadGame(saveName)) {
				return true;
			}
			loadPic("auxdr.alg", drawSurface2);
		}
	}

	showCursor();

	while (!shouldQuit()) {
		if (characterMoved == 0) {
			stepX = STEP_X;
			stepY = STEP_Y;
		}
		if (characterMoved == 0 && walkToObject == 1) {
			trackProtagonist = trackFinal;
			walkToObject = 0;
		}

		if (currentChapter == 2) {
			// NOTE: the checks for room number 14 below are a hack used in the original
			// game, and move the character to a place where his feet are not drawn above
			// the pianist's head. Originally, walkToObject was not updated properly, which
			// lead to an incorrect setting of the protagonist's tracking flag (above). This
			// made the character start walking off screen, as his actual position was
			// different than the displayed one
			if (roomNumber == 3 && (curX == 279) && (curY + curHeight == 101)) {
				gotoObject(178, 121);
				gotoObject(169, 135);
			} else if (roomNumber == 14 && (curX == 214) && (curY + curHeight == 121)) {
				walkToObject = 1;
				gotoObject(190, 130);
			} else if (roomNumber == 14 && (curX == 246) && (curY + curHeight == 112)) {
				walkToObject = 1;
				gotoObject(190, 130);
			}
		}

		moveCursor();
		updateScreen();

		if (currentChapter == 2) {
			if (musicStatus() == 0 && roomMusic != 0)
				playMusic(roomMusic);
		} else {
			if (musicStatus() == 0)
				playMusic(roomMusic);
		}

		delay(25);
#ifndef _WIN32_WCE
		// FIXME
		// This and the following #ifndefs disable the excess updateEvents() calls *within* the game loop.
		// Events such as keypresses or mouse clicks are dropped on the ground with no processing
		// by these calls. They are properly handled by the implicit call through getScan() below.
		// It is not a good practice to not process events and indeed this created problems with synthesized
		// events in the wince port.
		updateEvents();
#endif

		if (!_menuScreen && takeObject == 1)
			checkObjects();

#ifdef _WIN32_WCE
		if (rightMouseButton) {
			if (_menuScreen) {
#else
		if (rightMouseButton == 1 && _menuScreen) {
#endif
			rightMouseButton = 0;
			delay(100);
			if (currentChapter == 2) {
				loadPic(menuBackground, cursorSurface);
				loadPic(menuBackground, backSurface);
			} else {
				loadPic(99, cursorSurface);
				loadPic(99, backSurface);
			}
			setPalette((byte *)&gamePalette);
			_menuScreen = false;
#ifndef _WIN32_WCE
			// FIXME: This call here is in hope that it will catch the rightmouseup event so the
			// next if block won't be executed. This too is not a good coding practice. I've recoded it
			// with a mutual exclusive if block for the menu. I would commit this properly but I cannot test
			// for other (see Desktop) ports right now.
			updateEvents();
#endif
#ifdef _WIN32_WCE
			} else {
#else
		}

		// Do not show the inventory screen in chapter 5, if the right mouse button is clicked
		// while the plug (object 16) is held
		// Fixes bug #2059621 - "DRASCULA: Plug bug"
		if (rightMouseButton == 1 && !_menuScreen &&
			!(currentChapter == 5 && pickedObject == 16)) {
#endif
			rightMouseButton = 0;
			delay(100);
			characterMoved = 0;
			if (trackProtagonist == 2)
				trackProtagonist = 1;
			if (currentChapter == 4) {
				loadPic("icons2.alg", backSurface);
				loadPic("icons2.alg", cursorSurface);
			} else if (currentChapter == 5) {
				loadPic("icons3.alg", backSurface);
				loadPic("icons3.alg", cursorSurface);
			} else if (currentChapter == 6) {
				loadPic("iconsp.alg", backSurface);
				loadPic("iconsp.alg", cursorSurface);
			} else {
				loadPic("icons.alg", backSurface);
				loadPic("icons.alg", cursorSurface);
			}
			_menuScreen = true;
#ifndef _WIN32_WCE
			updateEvents();
#endif
			selectVerb(kVerbNone);
		}
#ifdef _WIN32_WCE
		}
#endif

		if (leftMouseButton == 1 && _menuBar) {
			delay(100);
			selectVerbFromBar();
		} else if (leftMouseButton == 1 && takeObject == 0) {
			delay(100);
			if (verify1())
				return true;
		} else if (leftMouseButton == 1 && takeObject == 1) {
			if (verify2())
				return true;
		}

		_menuBar = (mouseY < 24 && !_menuScreen) ? true : false;

		Common::KeyCode key = getScan();
		if (key == Common::KEYCODE_F1 && !_menuScreen) {
			selectVerb(kVerbLook);
		} else if (key == Common::KEYCODE_F2 && !_menuScreen) {
			selectVerb(kVerbPick);
		} else if (key == Common::KEYCODE_F3 && !_menuScreen) {
			selectVerb(kVerbOpen);
		} else if (key == Common::KEYCODE_F4 && !_menuScreen) {
			selectVerb(kVerbClose);
		} else if (key == Common::KEYCODE_F5 && !_menuScreen) {
			selectVerb(kVerbTalk);
		} else if (key == Common::KEYCODE_F6 && !_menuScreen) {
			selectVerb(kVerbMove);
		} else if (key == Common::KEYCODE_F9) {
			volumeControls();
		} else if (key == Common::KEYCODE_F10) {
			if (!saveLoadScreen())
				return true;
		} else if (key == Common::KEYCODE_F8) {
			selectVerb(kVerbNone);
		} else if (key == Common::KEYCODE_v) {
			_subtitlesDisabled = true;
			ConfMan.setBool("subtitles", !_subtitlesDisabled);

			print_abc(_textsys[2], 96, 86);
			updateScreen();
			delay(1410);
		} else if (key == Common::KEYCODE_t) {
			_subtitlesDisabled = false;
			ConfMan.setBool("subtitles", !_subtitlesDisabled);

			print_abc(_textsys[3], 94, 86);
			updateScreen();
			delay(1460);
		} else if (key == Common::KEYCODE_ESCAPE) {
			if (!confirmExit())
				return false;
		} else if (key == Common::KEYCODE_TILDE || key == Common::KEYCODE_BACKQUOTE) {
			_console->attach();
			_console->onFrame();
		} else if (currentChapter == 6 && key == Common::KEYCODE_0 && roomNumber == 61) {
			loadPic("alcbar.alg", bgSurface, 255);
		}

		if (leftMouseButton != 0 || rightMouseButton != 0 || key != 0)
			if (currentChapter != 3)
				framesWithoutAction = 0;

		if (framesWithoutAction == 15000) {
			screenSaver();
			if (currentChapter != 3)
				framesWithoutAction = 0;
		}

		if (currentChapter != 3)
			framesWithoutAction++;
	}

	return false;
}


bool DrasculaEngine::verify1() {
	int l;

	if (_menuScreen)
		removeObject();
	else {
		for (l = 0; l < numRoomObjs; l++) {
			if (mouseX >= x1[l] && mouseY >= y1[l]
					&& mouseX <= x2[l] && mouseY <= y2[l] && doBreak == 0) {
				if (exitRoom(l))
					return true;
				if (doBreak == 1)
					break;
			}
		}

		if (mouseX > curX && mouseY > curY
				&& mouseX < curX + curWidth && mouseY < curY + curHeight)
			doBreak = 1;

		for (l = 0; l < numRoomObjs; l++) {
			if (mouseX > x1[l] && mouseY > y1[l]
					&& mouseX < x2[l] && mouseY < y2[l] && doBreak == 0) {
				roomX = roomObjX[l];
				roomY = roomObjY[l];
				trackFinal = trackObj[l];
				doBreak = 1;
				walkToObject = 1;
				startWalking();
			}
		}

		if (doBreak == 0) {
			roomX = CLIP(mouseX, floorX1, floorX2);
			roomY = CLIP(mouseY, floorY1 + feetHeight, floorY2);
			startWalking();
		}
		doBreak = 0;
	}

	return false;
}
void CTimelineWidget::UpdateTimeline()
{
    QLayoutItem *child;
    if(layout() != Q_NULLPTR)
    {
        while (((child = layout()->takeAt(0)) != 0)) {
            //                                    delete child->widget();
            delete child;
        }
        delete layout();
    }   
    m_pLoader->start();
    QHBoxLayout* pHBLayout = new QHBoxLayout(this);
    pHBLayout->setSpacing(6);
    pHBLayout->setContentsMargins(3, 3, 3, 3);
    QPalette Pal(palette());
    Pal.setColor(QPalette::Background, QColor(240,240,240));
    setAutoFillBackground(true);
    setPalette(Pal);

    int iLayout1 = 0;
    int iLayout2 = 0;
    QList<int> lPendingGames = QList<int>();
    for (int i = 0; i < m_pThumbnailList->length(); i++)
    {
        if (m_pThumbnailList->at(i)->GetSyncedID() != QString("")) {
            int j = FindThumbnailIndex(m_pThumbnailList->at(i)->GetSyncedID());
            if (j >= 0) {
                if (i < j)
                {
                    pHBLayout->addWidget(NewColumn(true));
                    AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(pHBLayout->count()-1)->widget());
                    AddThumbnail(m_pThumbnailList->at(j), pHBLayout->itemAt(pHBLayout->count()-1)->widget());
                    if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_1)
                    {
                        iLayout1 = pHBLayout->count();
                        lPendingGames.append(iLayout1);
                    }
                    else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_2)
                    {
                        iLayout2 = pHBLayout->count();
                        lPendingGames.append(iLayout2);
                    }
                }
                else
                {
                    if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_1)
                    {
                        iLayout1 = lPendingGames.takeFirst();
                    }
                    else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_2)
                    {
                        iLayout2 = lPendingGames.takeFirst();
                    }
                }
            }
        }
        else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_1)
        {
            if (iLayout1 >= pHBLayout->count())
            {
                pHBLayout->addWidget(NewColumn(false));

            }
            if (!AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(iLayout1)->widget()))
            {
                pHBLayout->insertWidget(iLayout1, NewColumn(false));
                AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(iLayout1)->widget());
                iLayout2++;
                for (QList<int>::Iterator g = lPendingGames.begin(); g != lPendingGames.end(); g++) {
                    (*g)++;
                }
            }
            iLayout1++;
        }
        else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::PLAYER_2)
        {
            if (iLayout2 >= pHBLayout->count())
            {
                pHBLayout->addWidget(NewColumn(false));
            }
            if (!AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(iLayout2)->widget()))
            {
                pHBLayout->insertWidget(iLayout2, NewColumn(false));
                AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(iLayout2)->widget());
                iLayout1++;
                for (QList<int>::Iterator g = lPendingGames.begin(); g != lPendingGames.end(); g++) {
                    (*g)++;
                }
            }
            iLayout2++;
        }
        else if (m_pThumbnailList->at(i)->GetPlayerID() == CMainWindow::BOTH_PLAYER)
        {
            pHBLayout->addWidget(NewColumn(false));
            AddThumbnail(m_pThumbnailList->at(i), pHBLayout->itemAt(pHBLayout->count()-1)->widget());
            iLayout1 = pHBLayout->count();
            iLayout2 = pHBLayout->count();
        }
    }

    setLayout(pHBLayout);
}
Exemple #10
0
void SlideWidget::setImage( const QImage &image )
{
    QPalette palette;
    palette.setBrush( backgroundRole(), QBrush( QPixmap::fromImage( image ) ) );
    setPalette( palette );
}
bitInvaderView::bitInvaderView( Instrument * _instrument,
					QWidget * _parent ) :
	InstrumentView( _instrument, _parent )
{
	setAutoFillBackground( true );
	QPalette pal;

	pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap(
								"artwork" ) );
	setPalette( pal );
	
	m_sampleLengthKnob = new Knob( knobDark_28, this );
	m_sampleLengthKnob->move( 6, 201 );
	m_sampleLengthKnob->setHintText( tr( "Sample Length" ), "" );

	m_graph = new Graph( this, Graph::NearestStyle, 204, 134 );
	m_graph->move(23,59);	// 55,120 - 2px border
	m_graph->setAutoFillBackground( true );
	m_graph->setGraphColor( QColor( 255, 255, 255 ) );

	ToolTip::add( m_graph, tr ( "Draw your own waveform here "
				"by dragging your mouse on this graph."
	));


	pal = QPalette();
	pal.setBrush( backgroundRole(), 
			PLUGIN_NAME::getIconPixmap("wavegraph") );
	m_graph->setPalette( pal );


	m_sinWaveBtn = new PixmapButton( this, tr( "Sine wave" ) );
	m_sinWaveBtn->move( 131, 205 );
	m_sinWaveBtn->setActiveGraphic( embed::getIconPixmap(
						"sin_wave_active" ) );
	m_sinWaveBtn->setInactiveGraphic( embed::getIconPixmap(
						"sin_wave_inactive" ) );
	ToolTip::add( m_sinWaveBtn,
			tr( "Click for a sine-wave." ) );

	m_triangleWaveBtn = new PixmapButton( this, tr( "Triangle wave" ) );
	m_triangleWaveBtn->move( 131 + 14, 205 );
	m_triangleWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "triangle_wave_active" ) );
	m_triangleWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "triangle_wave_inactive" ) );
	ToolTip::add( m_triangleWaveBtn,
			tr( "Click here for a triangle-wave." ) );

	m_sawWaveBtn = new PixmapButton( this, tr( "Saw wave" ) );
	m_sawWaveBtn->move( 131 + 14*2, 205  );
	m_sawWaveBtn->setActiveGraphic( embed::getIconPixmap(
						"saw_wave_active" ) );
	m_sawWaveBtn->setInactiveGraphic( embed::getIconPixmap(
						"saw_wave_inactive" ) );
	ToolTip::add( m_sawWaveBtn,
			tr( "Click here for a saw-wave." ) );

	m_sqrWaveBtn = new PixmapButton( this, tr( "Square wave" ) );
	m_sqrWaveBtn->move( 131 + 14*3, 205 );
	m_sqrWaveBtn->setActiveGraphic( embed::getIconPixmap(
					"square_wave_active" ) );
	m_sqrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
					"square_wave_inactive" ) );
	ToolTip::add( m_sqrWaveBtn,
			tr( "Click here for a square-wave." ) );

	m_whiteNoiseWaveBtn = new PixmapButton( this,
					tr( "White noise wave" ) );
	m_whiteNoiseWaveBtn->move( 131 + 14*4, 205 );
	m_whiteNoiseWaveBtn->setActiveGraphic(
		embed::getIconPixmap( "white_noise_wave_active" ) );
	m_whiteNoiseWaveBtn->setInactiveGraphic(
		embed::getIconPixmap( "white_noise_wave_inactive" ) );
	ToolTip::add( m_whiteNoiseWaveBtn,
			tr( "Click here for white-noise." ) );

	m_usrWaveBtn = new PixmapButton( this, tr( "User defined wave" ) );
	m_usrWaveBtn->move( 131 + 14*5, 205 );
	m_usrWaveBtn->setActiveGraphic( embed::getIconPixmap(
						"usr_wave_active" ) );
	m_usrWaveBtn->setInactiveGraphic( embed::getIconPixmap(
						"usr_wave_inactive" ) );
	ToolTip::add( m_usrWaveBtn,
			tr( "Click here for a user-defined shape." ) );

	m_smoothBtn = new PixmapButton( this, tr( "Smooth" ) );
	m_smoothBtn->move( 131 + 14*6, 205 );
	m_smoothBtn->setActiveGraphic( PLUGIN_NAME::getIconPixmap(
						"smooth_active" ) );
	m_smoothBtn->setInactiveGraphic( PLUGIN_NAME::getIconPixmap(
						"smooth_inactive" ) );
	ToolTip::add( m_smoothBtn,
			tr( "Click here to smooth waveform." ) );


	m_interpolationToggle = new LedCheckBox( "Interpolation", this,
							tr( "Interpolation" ), LedCheckBox::Yellow );
	m_interpolationToggle->move( 131, 221 );


	m_normalizeToggle = new LedCheckBox( "Normalize", this,
							tr( "Normalize" ), LedCheckBox::Green );
	m_normalizeToggle->move( 131, 236 );
	
	
	connect( m_sinWaveBtn, SIGNAL (clicked () ),
			this, SLOT ( sinWaveClicked() ) );
	connect( m_triangleWaveBtn, SIGNAL ( clicked () ),
			this, SLOT ( triangleWaveClicked() ) );
	connect( m_sawWaveBtn, SIGNAL (clicked () ),
			this, SLOT ( sawWaveClicked() ) );
	connect( m_sqrWaveBtn, SIGNAL ( clicked () ),
			this, SLOT ( sqrWaveClicked() ) );
	connect( m_whiteNoiseWaveBtn, SIGNAL ( clicked () ),
			this, SLOT ( noiseWaveClicked() ) );
	connect( m_usrWaveBtn, SIGNAL ( clicked () ),
			this, SLOT ( usrWaveClicked() ) );
	
	connect( m_smoothBtn, SIGNAL ( clicked () ),
			this, SLOT ( smoothClicked() ) );		

	connect( m_interpolationToggle, SIGNAL( toggled( bool ) ),
			this, SLOT ( interpolationToggled( bool ) ) );

	connect( m_normalizeToggle, SIGNAL( toggled( bool ) ),
			this, SLOT ( normalizeToggled( bool ) ) );

}
Exemple #12
0
void VDXPlayer::getStill(Common::ReadStream *in) {
	uint16 numXTiles = in->readUint16LE();
	debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: numXTiles=%d", numXTiles);
	uint16 numYTiles = in->readUint16LE();
	debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: numYTiles=%d", numYTiles);

	// It's skipped in the original:
	uint16 colourDepth = in->readUint16LE();
	debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: colourDepth=%d", colourDepth);

	uint16 imageWidth = TILE_SIZE * numXTiles;

	uint8 mask = 0;
	byte *buf;
	if (_flagOne) {
		// Paint to the foreground
		buf = (byte *)_fg->getBasePtr(0, 0);
		if (_flag2Byte) {
			mask = 0xff;
		} else {
			mask = 0;
		}

		// TODO: Verify this is the right procedure. Couldn't find it on the
		// disassembly, but it's required to work properly
		_flagFirstFrame = true;
	} else {
		// Paint to the background
		buf = (byte *)_bg->getBasePtr(0, 0);
	}

	// Read the palette
	in->read(_palBuf, 3 * 256);

	if (_flagSeven) {
		_flagFive = true;
	}

	// Skip the frame when flag 5 is set, unless flag 1 is set
	if (!_flagFive || _flagOne) {

		byte colours[16];
		for (uint16 j = 0; j < numYTiles; j++) {
			byte *currentTile = buf + j * TILE_SIZE * imageWidth;
			for (uint16 i = numXTiles; i; i--) {
				uint8 colour1 = in->readByte();
				uint8 colour0 = in->readByte();
				uint16 colourMap = in->readUint16LE();
				expandColourMap(colours, colourMap, colour1, colour0);
				decodeBlockStill(currentTile, colours, 640, mask);

				currentTile += TILE_SIZE;
			}
		}

		// Apply the palette
		if (_flagNine) {
			// Flag 9 starts a fade in
			fadeIn(_palBuf);
		} else {
			if (!_flagOne && !_flagSeven) {
				// Actually apply the palette
				setPalette(_palBuf);
			}
		}

		if (!_flagOne) {
			_vm->_graphicsMan->updateScreen(_bg);
		}
		/*
		if (_flagSix) {
			if (_flagOne) {
				_vm->_graphicsMan->updateScreen(_fg);
			} else {
				_vm->_graphicsMan->updateScreen(_bg);
			}
			_flagSix = 0;
		}
		*/
	} else {
		// Skip the remaining data
		debugC(10, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Skipping still frame");
		while (!in->eos()) {
			in->readByte();
		}
	}
}
Exemple #13
0
void VDXPlayer::getDelta(Common::ReadStream *in) {
	uint16 k, l;

	// Get the size of the local palette
	uint16 palSize = in->readUint16LE();

	// Load the palette if it isn't empty
	if (palSize) {
		uint16 palBitField[16];

		// Load the bit field
		for (l = 0; l < 16; l++) {
			palBitField[l] = in->readUint16LE();
		}

		// Load the actual palette
		for (l = 0; l < 16; l++) {
			int flag = 1 << 15;
			for (uint16 j = 0; j < 16; j++) {
				int palIndex = (l * 16) + j;

				if (flag & palBitField[l]) {
					for (k = 0; k < 3; k++) {
						_palBuf[(palIndex * 3) + k] = in->readByte();
					}
				}
				flag = flag >> 1;
			}
		}

		// Apply the palette
		if (!_flagSeven) {
		//if (!_flagSix && !_flagSeven) {
			setPalette(_palBuf);
		}
	}

	uint8 currOpCode = in->readByte();
	uint8 param1, param2, param3;

	uint16 currentLine = 0;
	uint32 offset = 0;
	while (!in->eos()) {
		byte colours[16];
		if (currOpCode < 0x60) {
			param1 = in->readByte();
			param2 = in->readByte();
			expandColourMap(colours, vdxBlockMapLookup[currOpCode], param1, param2);
			decodeBlockDelta(offset, colours, 640);
			offset += TILE_SIZE;
		} else if (currOpCode > 0x7f) {
			param1 = in->readByte();
			param2 = in->readByte();
			param3 = in->readByte();
			expandColourMap(colours, (param1 << 8) + currOpCode, param2, param3);
			decodeBlockDelta(offset, colours, 640);
			offset += TILE_SIZE;
		} else switch (currOpCode) {
			case 0x60: /* Fill tile with the 16 colours given as parameters */
				for (l = 0; l < 16; l++) {
					colours[l] = in->readByte();
				}
				decodeBlockDelta(offset, colours, 640);
				offset += TILE_SIZE;
				break;
			case 0x61: /* Skip to the end of this line, next block is start of next */
				/* Note this is used at the end of EVERY line */
				currentLine++;
				offset = currentLine * TILE_SIZE * 640;
				break;
			case 0x62:
			case 0x63:
			case 0x64:
			case 0x65:
			case 0x66:
			case 0x67:
			case 0x68:
			case 0x69:
			case 0x6a:
			case 0x6b: /* Skip next param1 blocks (within line) */
				offset += (currOpCode - 0x62) * TILE_SIZE;
				break;
			case 0x6c:
			case 0x6d:
			case 0x6e:
			case 0x6f:
			case 0x70:
			case 0x71:
			case 0x72:
			case 0x73:
			case 0x74:
			case 0x75: /* Next param1 blocks are filled with colour param2 */
				param1 = currOpCode - 0x6b;
				param2 = in->readByte();
				for (l = 0; l < 16; l++) {
					colours[l] = param2;
				}
				for (k = 0; k < param1; k++) {
					decodeBlockDelta(offset, colours, 640);
					offset += TILE_SIZE;
				}
				break;
			case 0x76:
			case 0x77:
			case 0x78:
			case 0x79:
			case 0x7a:
			case 0x7b:
			case 0x7c:
			case 0x7d:
			case 0x7e:
			case 0x7f: /* Next bytes contain colours to fill the next param1 blocks in the current line*/
				param1 = currOpCode - 0x75;
				for (k = 0; k < param1; k++) {
					param2 = in->readByte();
					for (l = 0; l < 16; l++) {
						colours[l] = param2;
					}
					decodeBlockDelta(offset, colours, 640);
					offset += TILE_SIZE;
				}
				break;
			default:
				error("Groovie::VDX: Broken somehow");
		}
		currOpCode = in->readByte();
	}
}
KNMusicLibraryEmptyHint::KNMusicLibraryEmptyHint(QWidget *parent) :
    KNDropProxyContainer(parent)
{
    //Set properties.
    setAutoFillBackground(true);

    //Set palette.
    QPalette pal=palette();
    pal.setColor(QPalette::Window, QColor(0x35, 0x35, 0x35));
    pal.setColor(QPalette::WindowText, QColor(0xA0, 0xA0, 0xA0));
    setPalette(pal);

    //Initial the layout.
    QBoxLayout *mainLayout=new QBoxLayout(QBoxLayout::LeftToRight, this);
    setLayout(mainLayout);

    mainLayout->addStretch();

    QBoxLayout *contentLayout=new QBoxLayout(QBoxLayout::LeftToRight,
                                             mainLayout->widget());
    contentLayout->setContentsMargins(0,0,0,0);
    contentLayout->setSpacing(20);
    mainLayout->addLayout(contentLayout);

    //Initial the empty hint icon.
    QLabel *emptyHintIcon=new QLabel(this);
    emptyHintIcon->setPixmap(QPixmap(":/plugin/music/common/emptyicon.png"));
    contentLayout->addWidget(emptyHintIcon,
                          0,
                          Qt::AlignRight | Qt::AlignVCenter);

    //Initial the hint layout.
    QBoxLayout *hintLayout=new QBoxLayout(QBoxLayout::TopToBottom,
                                          contentLayout->widget());
    hintLayout->setSpacing(5);
    contentLayout->addLayout(hintLayout);
    mainLayout->addStretch();

    hintLayout->addStretch();
    //Initial the hint text lable.
    m_hintText=new QLabel(this);
    //Set palette.
    pal=m_hintText->palette();
    pal.setColor(QPalette::WindowText, QColor(0xA0, 0xA0, 0xA0));
    m_hintText->setPalette(pal);
    //Set the property.
    m_hintText->setMaximumWidth(600);
    m_hintText->setWordWrap(true);
    QFont hintTextFont=m_hintText->font();
    hintTextFont.setPixelSize(15);
    m_hintText->setFont(hintTextFont);
    //Add to layout.
    hintLayout->addWidget(m_hintText);
    hintLayout->addSpacing(20);

    //Initial the operate button.
    m_addMusic=new KNNGNLButton(this);
    m_addMusic->setIcon(QPixmap(":/plugin/music/library/library_add.png"));
    configureNGNLButton(m_addMusic);
    connect(m_addMusic, &KNNGNLButton::clicked,
            this, &KNMusicLibraryEmptyHint::onActionAddToLibrary);
    hintLayout->addWidget(m_addMusic);
    hintLayout->addStretch();

    //Connect retranslate signal.
    connect(KNGlobal::instance(), &KNGlobal::requireRetranslate,
            this, &KNMusicLibraryEmptyHint::retranslate);
    //Retranslate.
    retranslate();
}
US_RunDetails2::US_RunDetails2( const QVector< US_DataIO::RawData >& data, 
                                const QString&                       runID, 
                                const QString&                       dataDir, 
                                const QStringList&                   cell_ch_wl )
   : US_WidgetsDialog( 0, 0 ), dataList( data ), triples( cell_ch_wl )
{
   setWindowTitle( tr( "Details for Raw Data" ) );
   setPalette( US_GuiSettings::frameColor() );

   QGridLayout* main = new QGridLayout( this );
   main->setSpacing        ( 2 );
   main->setContentsMargins( 2, 2, 2, 2 );

   plotType  = TEMPERATURE;
   temp_warn = true;
   int row  = 0;

   // Plot Rows
   QBoxLayout* plot = new US_Plot( data_plot,
        tr( "Parameter Variation Throughout Run" ),
        tr( "Scan Number" ), 
        tr( "RPM * 1000 / Temperature " ) + DEGC );

   data_plot->setMinimumSize( 400, 200 );
   data_plot->enableAxis( QwtPlot::yRight );

   // Copy font for right axis from left axis
   QwtText axisTitle = data_plot->axisTitle( QwtPlot::yLeft );
   axisTitle.setText( tr( "Time between Scans (min)" ) );
   data_plot->setAxisTitle( QwtPlot::yRight, axisTitle );

   QwtPlotGrid* grid = us_grid( data_plot );
   grid->enableXMin( false );

   main->addLayout( plot, row, 0, 5, 6 );
   row += 6;

   // Row
   QLabel* lb_dir = us_label( tr( "Data Directory:" ) );
   main->addWidget( lb_dir, row, 0 );

   QLineEdit* le_dir = us_lineedit();
   le_dir->setReadOnly( true );
   le_dir->setText( dataDir );
   main->addWidget( le_dir, row++, 1, 1, 5 );

   // Row
   QLabel* lb_desc = us_label( tr( "Description:" ) );
   main->addWidget( lb_desc, row, 0 );

   le_desc = us_lineedit();
   le_desc->setReadOnly( true );
   le_desc->setText( dataDir );
   main->addWidget( le_desc, row++, 1, 1, 5 );

   // Row
   QLabel* lb_runID = us_label( tr( "Run Identification:" ) );
   main->addWidget( lb_runID, row, 0 );

   lw_rpm = us_listwidget();
   lw_rpm->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
   lw_rpm->setMinimumSize( 100, 50 );
   main->addWidget( lw_rpm, row, 2, 5, 2 );

   lw_triples = us_listwidget();
   lw_triples->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
   lw_triples->setMinimumSize( 100, 50 );
   main->addWidget( lw_triples, row, 4, 5, 2 );

   le_runID = us_lineedit();
   le_runID->setReadOnly( true );
   le_runID->setText( runID );
   main->addWidget( le_runID, row++, 1 );

   // Row
   QLabel* lb_runLen = us_label( tr( "Length of Run:" ) );
   main->addWidget( lb_runLen, row, 0 );

   le_runLen = us_lineedit();
   le_runLen->setReadOnly( true );
   main->addWidget( le_runLen, row++, 1 );

   // Row
   QLabel* lb_timeCorr = us_label( tr( "Time Correction:" ) );
   main->addWidget( lb_timeCorr, row, 0 );

   le_timeCorr = us_lineedit();
   le_timeCorr->setReadOnly( true );
   main->addWidget( le_timeCorr, row++, 1 );

   // Row
   QLabel* lb_rotorSpeed = us_label( tr( "Avg. Rotor Speed:" ) );
   main->addWidget( lb_rotorSpeed, row, 0 );

   le_rotorSpeed = us_lineedit();
   le_rotorSpeed->setReadOnly( true );
   main->addWidget( le_rotorSpeed, row++, 1 );

   // Row
   QLabel* lb_avgTemp = us_label( tr( "Avg. Temperature:" ) );
   main->addWidget( lb_avgTemp, row, 0 );

   le_avgTemp = us_lineedit();
   le_avgTemp->setReadOnly( true );
   main->addWidget( le_avgTemp, row++, 1 );

   // Row
   QLabel* lb_tempCheck = us_label( tr( "Temperature Check:" ) );
   main->addWidget( lb_tempCheck, row, 0 );

   QHBoxLayout* box1 = new QHBoxLayout;
   box1->setAlignment( Qt::AlignCenter );

   QHBoxLayout* box2 = new QHBoxLayout;
   box2->setAlignment( Qt::AlignCenter );
   box2->setSpacing( 10 );

   lb_green = new QLabel();
   lb_green->setFixedSize(20, 16);
   lb_green->setPalette( QPalette( QColor( 0, 0x44, 0 ) ) ); // Dark Green
   lb_green->setAutoFillBackground( true );
   lb_green->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

   lb_red   = new QLabel();
   lb_red->setFixedSize(20, 16);
   lb_red->setPalette( QPalette( QColor( 0x55, 0, 0 ) ) ); // Dark Red
   lb_red->setAutoFillBackground( true );
   lb_red->setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );

   box2->addWidget( lb_green );
   box2->addWidget( lb_red );
   box1->addLayout( box2 );

   main->addLayout( box1, row, 1 );

   QHBoxLayout* buttons = new QHBoxLayout();

   QPushButton* pb_temp = us_pushbutton( tr( "Temperature" ) );
   connect( pb_temp, SIGNAL( clicked() ), SLOT( plot_temp() ) );
   buttons->addWidget( pb_temp );

   QPushButton* pb_rpm = us_pushbutton( tr( "RPM" ) );
   connect( pb_rpm, SIGNAL( clicked() ), SLOT( plot_rpm() ) );
   buttons->addWidget( pb_rpm );

   QPushButton* pb_interval = us_pushbutton( tr( "Interval" ) );
   connect( pb_interval, SIGNAL( clicked() ), SLOT( plot_interval() ) );
   buttons->addWidget( pb_interval );

   QPushButton* pb_all = us_pushbutton( tr( "Combined" ) );
   connect( pb_all, SIGNAL( clicked() ), SLOT( plot_combined() ) );
   buttons->addWidget( pb_all );

   QPushButton* pb_close = us_pushbutton( tr( "Close" ) );
   connect( pb_close, SIGNAL( clicked() ), SLOT( close() ) );
   buttons->addWidget( pb_close );

   main->addLayout( buttons, row++, 2, 1, 4 );

   timer = new QTimer();
   connect( timer, SIGNAL( timeout() ), SLOT( update_timer() ) );

   setup();
   connect( lw_triples, SIGNAL( currentRowChanged( int ) ),
                        SLOT  ( update           ( int ) ) );

   connect( lw_rpm,     SIGNAL( itemClicked     ( QListWidgetItem* ) ),
            this,       SLOT  ( show_rpm_details( QListWidgetItem* ) ) );
}
StyleWidget::StyleWidget(QWidget *parent)
        : QWidget(parent)
{
    solid = new RenderArea(new QBrush(Qt::SolidPattern));
    dense1 = new RenderArea(new QBrush(Qt::Dense1Pattern));
    dense2 = new RenderArea(new QBrush(Qt::Dense2Pattern));
    dense3 = new RenderArea(new QBrush(Qt::Dense3Pattern));
    dense4 = new RenderArea(new QBrush(Qt::Dense4Pattern));
    dense5 = new RenderArea(new QBrush(Qt::Dense5Pattern));
    dense6 = new RenderArea(new QBrush(Qt::Dense6Pattern));
    dense7 = new RenderArea(new QBrush(Qt::Dense7Pattern));
    no = new RenderArea(new QBrush(Qt::NoBrush));
    hor = new RenderArea(new QBrush(Qt::HorPattern));
    ver = new RenderArea(new QBrush(Qt::VerPattern));
    cross = new RenderArea(new QBrush(Qt::CrossPattern));
    bdiag = new RenderArea(new QBrush(Qt::BDiagPattern));
    fdiag = new RenderArea(new QBrush(Qt::FDiagPattern));
    diagCross = new RenderArea(new QBrush(Qt::DiagCrossPattern));
    linear = new RenderArea(new QBrush(QLinearGradient()));
    radial = new RenderArea(new QBrush(QRadialGradient()));
    conical = new RenderArea(new QBrush(QConicalGradient()));
    texture = new RenderArea(new QBrush(QPixmap("qt-logo.png")));

    solidLabel = new QLabel("Qt::SolidPattern");
    dense1Label = new QLabel("Qt::Dense1Pattern");
    dense2Label = new QLabel("Qt::Dense2Pattern");
    dense3Label = new QLabel("Qt::Dense3Pattern");
    dense4Label = new QLabel("Qt::Dense4Pattern");
    dense5Label = new QLabel("Qt::Dense5Pattern");
    dense6Label = new QLabel("Qt::Dense6Pattern");
    dense7Label = new QLabel("Qt::Dense7Pattern");
    noLabel = new QLabel("Qt::NoPattern");
    horLabel = new QLabel("Qt::HorPattern");
    verLabel = new QLabel("Qt::VerPattern");
    crossLabel = new QLabel("Qt::CrossPattern");
    bdiagLabel = new QLabel("Qt::BDiagPattern");
    fdiagLabel = new QLabel("Qt::FDiagPattern");
    diagCrossLabel = new QLabel("Qt::DiagCrossPattern");
    linearLabel = new QLabel("Qt::LinearGradientPattern");
    radialLabel = new QLabel("Qt::RadialGradientPattern");
    conicalLabel = new QLabel("Qt::ConicalGradientPattern");
    textureLabel = new QLabel("Qt::TexturePattern");

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(solid, 0, 0);
    layout->addWidget(dense1, 0, 1);
    layout->addWidget(dense2, 0, 2);
    layout->addWidget(solidLabel, 1, 0);
    layout->addWidget(dense1Label, 1, 1);
    layout->addWidget(dense2Label, 1, 2);

    layout->addWidget(dense3, 2, 0 );
    layout->addWidget(dense4, 2, 1);
    layout->addWidget(dense5, 2, 2);
    layout->addWidget(dense3Label, 3, 0);
    layout->addWidget(dense4Label, 3, 1);
    layout->addWidget(dense5Label, 3, 2);

    layout->addWidget(dense6, 4, 0);
    layout->addWidget(dense7, 4, 1);
    layout->addWidget(no, 4, 2);
    layout->addWidget(dense6Label, 5, 0);
    layout->addWidget(dense7Label, 5, 1);
    layout->addWidget(noLabel, 5, 2);

    layout->addWidget(hor, 6, 0);
    layout->addWidget(ver, 6, 1);
    layout->addWidget(cross, 6, 2);
    layout->addWidget(horLabel, 7, 0);
    layout->addWidget(verLabel, 7, 1);
    layout->addWidget(crossLabel, 7, 2);

    layout->addWidget(bdiag, 8, 0);
    layout->addWidget(fdiag, 8, 1);
    layout->addWidget(diagCross, 8, 2);
    layout->addWidget(bdiagLabel, 9, 0);
    layout->addWidget(fdiagLabel, 9, 1);
    layout->addWidget(diagCrossLabel, 9, 2);

    layout->addWidget(linear, 10, 0);
    layout->addWidget(radial, 10, 1);
    layout->addWidget(conical, 10, 2);
    layout->addWidget(linearLabel, 11, 0);
    layout->addWidget(radialLabel, 11, 1);
    layout->addWidget(conicalLabel, 11, 2);

    layout->addWidget(texture, 12, 0, 1, 3);
    layout->addWidget(textureLabel, 13, 0, 1, 3);

    setLayout(layout);

    QPalette newPalette = palette();
    newPalette.setColor(QPalette::Window, Qt::white);
    setPalette(newPalette);

    setWindowTitle(tr("Brush Styles"));
    resize(430, 605);
}
Exemple #17
0
BitcoinGUI::BitcoinGUI(QWidget *parent):
    QMainWindow(parent),
    clientModel(0),
    walletModel(0),
    encryptWalletAction(0),
    changePassphraseAction(0),
    aboutQtAction(0),
    trayIcon(0),
    notificator(0),
    rpcConsole(0)
{
    resize(850, 550);
    setWindowTitle(tr("NobleCoin") + " - " + tr("Wallet"));
#ifndef Q_WS_MAC
    qApp->setWindowIcon(QIcon(":icons/bitcoin"));
    setWindowIcon(QIcon(":icons/bitcoin"));
#else
    setUnifiedTitleAndToolBarOnMac(true);
    QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
    // Accept D&D of URIs
    setAcceptDrops(true);

    // Create actions for the toolbar, menu bar and tray/dock icon
    createActions();

    // Create application menu bar
    createMenuBar();

    // Create the toolbars
    createToolBars();

    // Create the tray icon (or setup the dock icon)
    createTrayIcon();

	QPalette p;
	p.setColor(QPalette::Window, QColor(0x22, 0x22, 0x22));
	p.setColor(QPalette::Button, QColor(0x22, 0x22, 0x22));
	p.setColor(QPalette::Mid, QColor(0x22, 0x22, 0x22));
	p.setColor(QPalette::Base, QColor(0x22, 0x22, 0x22));
	p.setColor(QPalette::AlternateBase, QColor(0x22, 0x22, 0x22));
	setPalette(p);
	QFile style(":/text/res/text/style.qss");
	style.open(QFile::ReadOnly);
	setStyleSheet(QString::fromUtf8(style.readAll()));

    /* don't override the background color of the toolbar on mac os x due to
       the whole component it resides on not being paintable
     */
#ifdef Q_OS_MAC
    toolbar->setStyleSheet("QToolBar { background-color: transparent; border: 0px solid black; padding: 3px; }");
#endif
    // Create tabs
    overviewPage = new OverviewPage();
	chatWindow = new ChatWindow(this); //Create Chat Window
	blockExplorer = new BlockExplorer(this); //Include Block Explorer
    transactionsPage = new QWidget(this);
    QVBoxLayout *vbox = new QVBoxLayout();
    transactionView = new TransactionView(this);
    vbox->addWidget(transactionView);
    transactionsPage->setLayout(vbox);

    addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);

    receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);

    sendCoinsPage = new SendCoinsDialog(this);

    signVerifyMessageDialog = new SignVerifyMessageDialog(this);

    centralWidget = new QStackedWidget(this);
	centralWidget->addWidget(chatWindow); //Add Chat Window
	centralWidget->addWidget(blockExplorer); //Create Block Explorer
    centralWidget->addWidget(overviewPage);
    centralWidget->addWidget(transactionsPage);
    centralWidget->addWidget(addressBookPage);
    centralWidget->addWidget(receiveCoinsPage);
    centralWidget->addWidget(sendCoinsPage);
#ifdef FIRST_CLASS_MESSAGING
    centralWidget->addWidget(signVerifyMessageDialog);
#endif
    setCentralWidget(centralWidget);

    // Create status bar
    statusBar();

    // Status bar notification icons
    QFrame *frameBlocks = new QFrame();
    frameBlocks->setContentsMargins(0,0,0,0);
    frameBlocks->setMinimumWidth(73);
    frameBlocks->setMaximumWidth(73);
    QHBoxLayout *frameBlocksLayout = new QHBoxLayout(frameBlocks);
    frameBlocksLayout->setContentsMargins(3,0,3,0);
    frameBlocksLayout->setSpacing(3);
    labelEncryptionIcon = new QLabel();
    labelConnectionsIcon = new QLabel();
    labelBlocksIcon = new QLabel();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelEncryptionIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelConnectionsIcon);
    frameBlocksLayout->addStretch();
    frameBlocksLayout->addWidget(labelBlocksIcon);
    frameBlocksLayout->addStretch();

    // Progress bar and label for blocks download
    progressBarLabel = new QLabel();
    progressBarLabel->setVisible(false);
    progressBar = new QProgressBar();
    progressBar->setAlignment(Qt::AlignCenter);
    progressBar->setVisible(false);

    statusBar()->addWidget(progressBarLabel);
    statusBar()->addWidget(progressBar);
    statusBar()->addPermanentWidget(frameBlocks);

    syncIconMovie = new QMovie(":/movies/update_spinner", "mng", this);

    // Clicking on a transaction on the overview page simply sends you to transaction history page
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), this, SLOT(gotoHistoryPage()));
    connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex)));

    // Double-clicking on a transaction on the transaction history page shows details
    connect(transactionView, SIGNAL(doubleClicked(QModelIndex)), transactionView, SLOT(showDetails()));

    rpcConsole = new RPCConsole(this);
    connect(openRPCConsoleAction, SIGNAL(triggered()), rpcConsole, SLOT(show()));

    // Clicking on "Verify Message" in the address book sends you to the verify message tab
    connect(addressBookPage, SIGNAL(verifyMessage(QString)), this, SLOT(gotoVerifyMessageTab(QString)));
    // Clicking on "Sign Message" in the receive coins page sends you to the sign message tab
    connect(receiveCoinsPage, SIGNAL(signMessage(QString)), this, SLOT(gotoSignMessageTab(QString)));

    gotoOverviewPage();
}
Exemple #18
0
void gPainter::setPalette(gPixmap *source)
{
	ASSERT(source);
	setPalette(source->surface->clut.data, source->surface->clut.start, source->surface->clut.colors);
}
Exemple #19
0
void Console::setTextColor(QColor c) {
    QPalette p = palette();
    p.setColor(QPalette::Text, c);
    setPalette(p);
}
Exemple #20
0
// TODO remove
void SkLabel::setPaletteBackgroundColor (const QColor &color)
{
	QPalette palette;
	palette.setColor (backgroundRole (), color);
	setPalette(palette);
}
TrackDashboard::TrackDashboard()
{   
    nam = new WsAccessManager( this );
    
    ui.papyrus = new QWidget( this );    
    ui.cover = new PrettyCoverWidget;
    ui.cover->setParent( ui.papyrus );
    
    connect( ui.cover, SIGNAL( clicked()), SLOT( onCoverClicked()));
    
    setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    
    ui.info = new QWidget( ui.papyrus );
    QVBoxLayout* v = new QVBoxLayout( ui.info );
    
    v->addWidget( ui.bio = new BioWebView );

    v->addSpacing( 10 );
    v->addWidget( new QLabel( tr( HEADING "Tags") ) );
    v->addSpacing( 3 );
    v->addWidget( ui.tags = new ListView );
    ((ListView*)ui.tags)->setSeedType( Seed::TagType );
    v->addSpacing( 10 );
    v->addWidget( new QLabel( tr( HEADING "Similar Artists") ) );
    v->addSpacing( 3 );
    v->addWidget( ui.similarArtists = new ListView );
    ((ListView*)ui.similarArtists)->setSeedType( Seed::ArtistType );
    v->setMargin( 0 );
    v->setSpacing( 0 );

    ui.bio->page()->mainFrame()->setScrollBarPolicy( Qt::Vertical, Qt::ScrollBarAlwaysOff );
    ui.bio->page()->mainFrame()->setScrollBarPolicy( Qt::Horizontal, Qt::ScrollBarAlwaysOff );
    ui.bio->page()->setLinkDelegationPolicy( QWebPage::DelegateExternalLinks );
    ui.bio->setAutoFillBackground( true );
    connect( ui.bio, SIGNAL(linkClicked( const QUrl& )), SLOT(openExternally( const QUrl& )) );

    ui.scrollbar = new FadingScrollBar( this );
    ui.scrollbar->setVisible( false );
    connect( ui.scrollbar, SIGNAL(valueChanged( int )), SLOT(setPapyrusPosition( int )) );

#ifndef Q_WS_MAC
    // mac has finer grained scrolling, and acceleration
    ui.scrollbar->setSingleStep( 9 );
#endif

    UnicornWidget::paintItBlack( this );
    UnicornWidget::paintItBlack( ui.bio );
    setAutoFillBackground( true );

    QPalette p = palette();
    QColor c( 0x0e, 0x0e, 0x0e );
    p.setColor( QPalette::Window, c );
    p.setColor( QPalette::Base, Qt::transparent );
    p.setColor( QPalette::Text, Qt::white );
    setPalette( p );
    p.setColor( QPalette::Text, QColor( 0xa3, 0xa5, 0xa8 ) );
    ui.bio->setPalette( p );

	ui.spinner = new SpinnerLabel( this );
    ui.spinner->move( 10, 10 );

    clear();

    setAttribute( Qt::WA_MacNoClickThrough );
    
    ui.sources = new QPushButton( AuthenticatedUser().name(), this );
}
	ArticleStateUfo::ArticleStateUfo(ArticleDefinitionUfo *defs) : ArticleState(defs->id)
	{
		RuleUfo *ufo = _game->getMod()->getUfo(defs->id);

		// add screen elements
		_txtTitle = new Text(155, 32, 5, 24);

		// Set palette
		setPalette("PAL_GEOSCAPE");

		ArticleState::initLayout();

		// add other elements
		add(_txtTitle);

		// Set up objects
		_game->getMod()->getSurface("BACK11.SCR")->blit(_bg);
		_btnOk->setColor(Palette::blockOffset(8)+5);
		_btnPrev->setColor(Palette::blockOffset(8)+5);
		_btnNext->setColor(Palette::blockOffset(8)+5);

		_txtTitle->setColor(Palette::blockOffset(8)+5);
		_txtTitle->setBig();
		_txtTitle->setWordWrap(true);
		_txtTitle->setText(tr(defs->title));

		_image = new Surface(160, 52, 160, 6);
		add(_image);

		RuleInterface *dogfightInterface = _game->getMod()->getInterface("dogfight");
		Surface *graphic = _game->getMod()->getSurface("INTERWIN.DAT");
		graphic->setX(0);
		graphic->setY(0);
		graphic->getCrop()->x = 0;
		graphic->getCrop()->y = 0;
		graphic->getCrop()->w = _image->getWidth();
		graphic->getCrop()->h = _image->getHeight();
		_image->drawRect(graphic->getCrop(), 15);
		graphic->blit(_image);

		if (ufo->getModSprite().empty())
		{
			graphic->getCrop()->y = dogfightInterface->getElement("previewMid")->y + dogfightInterface->getElement("previewMid")->h * ufo->getSprite();
			graphic->getCrop()->h = dogfightInterface->getElement("previewMid")->h;
		}
		else
		{
			graphic = _game->getMod()->getSurface(ufo->getModSprite());
		}
		graphic->setX(0);
		graphic->setY(0);
		graphic->blit(_image);

		_txtInfo = new Text(300, 50, 10, 140);
		add(_txtInfo);

		_txtInfo->setColor(Palette::blockOffset(8)+5);
		_txtInfo->setWordWrap(true);
		_txtInfo->setText(tr(defs->text));

		_lstInfo = new TextList(310, 64, 10, 68);
		add(_lstInfo);

		centerAllSurfaces();

		_lstInfo->setColor(Palette::blockOffset(8)+5);
		_lstInfo->setColumns(2, 200, 110);
//		_lstInfo->setCondensed(true);
		_lstInfo->setBig();
		_lstInfo->setDot(true);

		_lstInfo->addRow(2, tr("STR_DAMAGE_CAPACITY").c_str(), Text::formatNumber(ufo->getMaxDamage()).c_str());

		_lstInfo->addRow(2, tr("STR_WEAPON_POWER").c_str(), Text::formatNumber(ufo->getWeaponPower()).c_str());

		_lstInfo->addRow(2, tr("STR_WEAPON_RANGE").c_str(), tr("STR_KILOMETERS").arg(ufo->getWeaponRange()).c_str());

		_lstInfo->addRow(2, tr("STR_MAXIMUM_SPEED").c_str(), tr("STR_KNOTS").arg(Text::formatNumber(ufo->getMaxSpeed())).c_str());
	}
/**
 * Initializes all the elements in the productions list screen.
 * @param game Pointer to the core game.
 * @param base Pointer to the base to get info from.
 */
NewManufactureListState::NewManufactureListState(Base *base) : _base(base)
{
	_screen = false;

	_window = new Window(this, 320, 156, 0, 22, POPUP_BOTH);
	_btnOk = new TextButton(304, 16, 8, 154);
	_txtTitle = new Text(320, 17, 0, 30);
	_txtItem = new Text(156, 9, 10, 62);
	_txtCategory = new Text(130, 9, 166, 62);
	_lstManufacture = new TextList(288, 80, 8, 70);
	_cbxCategory = new ComboBox(this, 146, 16, 166, 46);

	// Set palette
	setPalette("PAL_BASESCAPE", 6);

	add(_window);
	add(_btnOk);
	add(_txtTitle);
	add(_txtItem);
	add(_txtCategory);
	add(_lstManufacture);
	add(_cbxCategory);

	centerAllSurfaces();

	_window->setColor(Palette::blockOffset(15)+1);
	_window->setBackground(_game->getResourcePack()->getSurface("BACK17.SCR"));
	_txtTitle->setColor(Palette::blockOffset(15)+1);
	_txtTitle->setText(tr("STR_PRODUCTION_ITEMS"));
	_txtTitle->setBig();
	_txtTitle->setAlign(ALIGN_CENTER);

	_txtItem->setColor(Palette::blockOffset(15)+1);
	_txtItem->setText(tr("STR_ITEM"));

	_txtCategory->setColor(Palette::blockOffset(15)+1);
	_txtCategory->setText(tr("STR_CATEGORY"));

	_lstManufacture->setColumns(2, 156, 130);
	_lstManufacture->setSelectable(true);
	_lstManufacture->setBackground(_window);
	_lstManufacture->setMargin(2);
	_lstManufacture->setColor(Palette::blockOffset(13));
	_lstManufacture->setArrowColor(Palette::blockOffset(15)+1);
	_lstManufacture->onMouseClick((ActionHandler)&NewManufactureListState::lstProdClick);

	_btnOk->setColor(Palette::blockOffset(13)+10);
	_btnOk->setText(tr("STR_OK"));
	_btnOk->onMouseClick((ActionHandler)&NewManufactureListState::btnOkClick);
	_btnOk->onKeyboardPress((ActionHandler)&NewManufactureListState::btnOkClick, Options::keyCancel);

	_possibleProductions.clear();
	_game->getSavedGame()->getAvailableProductions(_possibleProductions, _game->getRuleset(), _base);
	_catStrings.push_back("STR_ALL_ITEMS");

	for (std::vector<RuleManufacture *>::iterator it = _possibleProductions.begin(); it != _possibleProductions.end(); ++it)
	{
		bool addCategory = true;
		for (size_t x = 0; x < _catStrings.size(); ++x)
		{
			if ((*it)->getCategory().c_str() == _catStrings[x])
			{
				addCategory = false;
				break;
			}
		}
		if (addCategory)
		{
			_catStrings.push_back((*it)->getCategory().c_str());
		}
	}

	_cbxCategory->setColor(Palette::blockOffset(15)+1);
	_cbxCategory->setOptions(_catStrings);
	_cbxCategory->onChange((ActionHandler)&NewManufactureListState::cbxCategoryChange);

}
Exemple #24
0
/**
 * Initializes all the elements in the Options window.
 * @param game Pointer to the core game.
 * @param origin Game section that originated this state.
 */
OptionsBaseState::OptionsBaseState(OptionsOrigin origin) : _origin(origin)
{
	// Create objects
	_window = new Window(this, 320, 200, 0, 0);

	_btnVideo = new TextButton(80, 16, 8, 8);
	_btnAudio = new TextButton(80, 16, 8, 28);
	_btnControls = new TextButton(80, 16, 8, 48);
	_btnGeoscape = new TextButton(80, 16, 8, 68);
	_btnBattlescape = new TextButton(80, 16, 8, 88);
	_btnAdvanced = new TextButton(80, 16, 8, 108);
	_btnMods = new TextButton(80, 16, 8, 128);
	
	_btnOk = new TextButton(100, 16, 8, 176);
	_btnCancel = new TextButton(100, 16, 110, 176);
	_btnDefault = new TextButton(100, 16, 212, 176);

	_txtTooltip = new Text(305, 25, 8, 148);

	// Set palette
	if (_origin == OPT_BATTLESCAPE)
	{
		setPalette("PAL_BATTLESCAPE");
	}
	else
	{
		setPalette("PAL_GEOSCAPE", 0);
	}

	add(_window);

	add(_btnVideo);
	add(_btnAudio);
	add(_btnControls);
	add(_btnGeoscape);
	add(_btnBattlescape);
	add(_btnAdvanced);
	add(_btnMods);

	add(_btnOk);
	add(_btnCancel);
	add(_btnDefault);

	add(_txtTooltip);

	// Set up objects
	_window->setColor(Palette::blockOffset(8)+5);
	_window->setBackground(_game->getResourcePack()->getSurface("BACK01.SCR"));

	_btnVideo->setColor(Palette::blockOffset(8)+5);
	_btnVideo->setText(tr("STR_VIDEO"));
	_btnVideo->onMousePress((ActionHandler)&OptionsBaseState::btnGroupPress, SDL_BUTTON_LEFT);

	_btnAudio->setColor(Palette::blockOffset(8)+5);
	_btnAudio->setText(tr("STR_AUDIO"));
	_btnAudio->onMousePress((ActionHandler)&OptionsBaseState::btnGroupPress, SDL_BUTTON_LEFT);

	_btnControls->setColor(Palette::blockOffset(8)+5);
	_btnControls->setText(tr("STR_CONTROLS"));
	_btnControls->onMousePress((ActionHandler)&OptionsBaseState::btnGroupPress, SDL_BUTTON_LEFT);

	_btnGeoscape->setColor(Palette::blockOffset(8)+5);
	_btnGeoscape->setText(tr("STR_GEOSCAPE_UC"));
	_btnGeoscape->onMousePress((ActionHandler)&OptionsBaseState::btnGroupPress, SDL_BUTTON_LEFT);

	_btnBattlescape->setColor(Palette::blockOffset(8)+5);
	_btnBattlescape->setText(tr("STR_BATTLESCAPE_UC"));
	_btnBattlescape->onMousePress((ActionHandler)&OptionsBaseState::btnGroupPress, SDL_BUTTON_LEFT);

	_btnAdvanced->setColor(Palette::blockOffset(8)+5);
	_btnAdvanced->setText(tr("STR_ADVANCED"));
	_btnAdvanced->onMousePress((ActionHandler)&OptionsBaseState::btnGroupPress, SDL_BUTTON_LEFT);

	_btnMods->setColor(Palette::blockOffset(8)+5);
	_btnMods->setText(tr("STR_MODS"));
	_btnMods->onMousePress((ActionHandler)&OptionsBaseState::btnGroupPress, SDL_BUTTON_LEFT);
	_btnMods->setVisible(_origin == OPT_MENU); // Mods require a restart, don't enable them in-game

	_btnOk->setColor(Palette::blockOffset(8)+5);
	_btnOk->setText(tr("STR_OK"));
	_btnOk->onMouseClick((ActionHandler)&OptionsBaseState::btnOkClick);
	_btnOk->onKeyboardPress((ActionHandler)&OptionsBaseState::btnOkClick, Options::keyOk);

	_btnCancel->setColor(Palette::blockOffset(8)+5);
	_btnCancel->setText(tr("STR_CANCEL"));
	_btnCancel->onMouseClick((ActionHandler)&OptionsBaseState::btnCancelClick);
	_btnCancel->onKeyboardPress((ActionHandler)&OptionsBaseState::btnCancelClick, Options::keyCancel);

	_btnDefault->setColor(Palette::blockOffset(8)+5);
	_btnDefault->setText(tr("STR_RESTORE_DEFAULTS"));
	_btnDefault->onMouseClick((ActionHandler)&OptionsBaseState::btnDefaultClick);

	_txtTooltip->setColor(Palette::blockOffset(8)+5);
	_txtTooltip->setWordWrap(true);
}
Exemple #25
0
/**
 * Initializes all the elements in the Soldier Armor window.
 * @param game Pointer to the core game.
 * @param base Pointer to the base to get info from.
 * @param soldier ID of the selected soldier.
 */
SoldierArmorState::SoldierArmorState(Game *game, Base *base, size_t soldier) : State(game), _base(base), _soldier(soldier)
{
	_screen = false;

	// Create objects
	_window = new Window(this, 192, 120, 64, 40, POPUP_BOTH);
	_btnCancel = new TextButton(140, 16, 90, 136);
	_txtTitle = new Text(182, 16, 69, 48);
	_txtType = new Text(90, 9, 80, 72);
	_txtQuantity = new Text(70, 9, 177, 72);
	_lstArmor = new TextList(160, 40, 73, 88);

	// Set palette
	setPalette("PAL_BASESCAPE", 4);

	add(_window);
	add(_btnCancel);
	add(_txtTitle);
	add(_txtType);
	add(_txtQuantity);
	add(_lstArmor);

	centerAllSurfaces();

	// Set up objects
	_window->setColor(Palette::blockOffset(13)+10);
	_window->setBackground(_game->getResourcePack()->getSurface("BACK14.SCR"));

	_btnCancel->setColor(Palette::blockOffset(13)+5);
	_btnCancel->setText(tr("STR_CANCEL_UC"));
	_btnCancel->onMouseClick((ActionHandler)&SoldierArmorState::btnCancelClick);
	_btnCancel->onKeyboardPress((ActionHandler)&SoldierArmorState::btnCancelClick, Options::keyCancel);

	Soldier *s = _base->getSoldiers()->at(_soldier);
	_txtTitle->setColor(Palette::blockOffset(13)+5);
	_txtTitle->setAlign(ALIGN_CENTER);
	_txtTitle->setText(tr("STR_SELECT_ARMOR_FOR_SOLDIER").arg(s->getName()));

	_txtType->setColor(Palette::blockOffset(13)+5);
	_txtType->setText(tr("STR_TYPE"));

	_txtQuantity->setColor(Palette::blockOffset(13)+5);
	_txtQuantity->setText(tr("STR_QUANTITY_UC"));

	_lstArmor->setColor(Palette::blockOffset(13));
	_lstArmor->setArrowColor(Palette::blockOffset(13)+5);
	_lstArmor->setColumns(2, 112, 41);
	_lstArmor->setSelectable(true);
	_lstArmor->setBackground(_window);
	_lstArmor->setMargin(8);

	const std::vector<std::string> &armors = _game->getRuleset()->getArmorsList();
	for (std::vector<std::string>::const_iterator i = armors.begin(); i != armors.end(); ++i)
	{
		Armor *a = _game->getRuleset()->getArmor(*i);
		if (_base->getItems()->getItem(a->getStoreItem()) > 0)
		{
			_armors.push_back(a);
			std::wostringstream ss;
			if (_game->getSavedGame()->getMonthsPassed() > -1)
			{
				ss << _base->getItems()->getItem(a->getStoreItem());
			}
			else
			{
				ss << "-";
			}
			_lstArmor->addRow(2, tr(a->getType()).c_str(), ss.str().c_str());
		}
		else if (a->getStoreItem() == "STR_NONE")
		{
			_armors.push_back(a);
			_lstArmor->addRow(1, tr(a->getType()).c_str());
		}
	}
	_lstArmor->onMouseClick((ActionHandler)&SoldierArmorState::lstArmorClick);
}
PlotArea::PlotArea(QWidget *parent)     : QWidget(parent)
{

	LambdaBox  = new QCheckBox(tr("Lambda"));
	RPMBox          = new QCheckBox(tr("RPM"));
	VEBox      = new QCheckBox(tr("VE"));
	MAPBox          = new QCheckBox(tr("MAP"));
	airTempBox = new QCheckBox(tr("Air Temp"));
	waterTempBox   = new QCheckBox(tr("Water Temp"));
	ignAdvanceBox  = new QCheckBox(tr("Ignition Advance"));
	fuelAdvBox = new QCheckBox(tr("Fuel Advance"));
	dutyBox    = new QCheckBox(tr("Duty %"));
	injTimeBox = new QCheckBox(tr("Inj Time"));
	throttleBox    = new QCheckBox(tr("Throttle pos"));

	readSettings();
	setBackgroundRole(QPalette::Base);
	setMinimumSize(100,100);
	setAutoFillBackground(true);
	BackColor.setRgb(255, 255, 255);
	penColor.setRgb(150, 150, 150);
	channel1Color.setRgb(0, 0, 0);
	//backBrush.setColor(BackColor);

	palette.setColor(backgroundRole(), BackColor);
	setPalette(palette);

	points = new QPoint[1100];
	const int base = height();	 //out of range
	for(int i=0;i<1100;++i)		 //width()-15;++i)
	{
		(points+i)->setX(i+25);
		(points+i)->setY(base);
	}
	channel = 3;
	reversed = true;
	scaleFactorX = 1;
	scaleFactorY = 1;
	rows = 9;
	columns = 15;
	xSize=300;
	ySize=200;
	pointsReceived = 0;

	for(int i=0;i<rows;++i)
	{
		scaleY[i] = (i) * scaleFactorY;
	}

	menu = new QMenu;

	selectChannelAct = new QAction(tr("Select channels"), this);
	connect(selectChannelAct, SIGNAL(triggered()), this, SLOT(chooseDialog()));

	menu->addAction(selectChannelAct);
	colors = menu->addMenu("Colors");
	backColorAct = colors->addAction(tr("Background"));
	fontColorAct = colors->addAction(tr("Font Color"));
	chan1ColorAct = colors->addAction(tr("Channel 1"));
	chan2ColorAct = colors->addAction(tr("Channel 2"));
	chan3ColorAct = colors->addAction(tr("Channel 3"));

	connect(backColorAct, SIGNAL(triggered()), this, SLOT(setBackColorSlot()));
	connect(fontColorAct, SIGNAL(triggered()), this, SLOT(setFontColorSlot()));
	connect(chan1ColorAct, SIGNAL(triggered()), this, SLOT(setChannel1ColorSlot()));
	connect(chan2ColorAct, SIGNAL(triggered()), this, SLOT(setBackColorSlot()));
	connect(chan3ColorAct, SIGNAL(triggered()), this, SLOT(setBackColorSlot()));

}
Exemple #27
0
qMessageBoard::qMessageBoard(qMessageBoradAttr* pItem, QWidget *parent):QDialog(parent),ui(new Ui::qMessageBoard)
{
    ui->setupUi(this);

    oId = -1;
    setFixedSize(size());
    QPalette palette;
    palette.setColor(QPalette::Background, QColor(224,237,254));
    setPalette(palette);
    //setWindowOpacity(0.95);

    bInit       = false;
    m_pCopyItem = NULL;
    pTempItem   = NULL;
    curLan = 0;

    pSecurityWight = new SecurityWidget(this);
    ui->tabWidget->addTab(pSecurityWight, tr("权限设置"));
    //pSecurityWight->ui->groupBox_Touch->hide();

    pScene = new QGraphicsScene(this); //建场景
    ui->graphicsView->setScene(pScene);//贴图区域

    this->setWindowTitle(tr("留言板"));

    //语言
    ui->comboBox_language->clear();
    int temp = pwnd->m_pSamSysParame->m_mixGlobalVar.m_vecLanguageNameList.size();
    for(int i = 0; i < temp; i++)
    {
        ui->comboBox_language->addItem(pwnd->m_pSamSysParame->m_mixGlobalVar.m_vecLanguageNameList[i]);
    }

    //字体
    ui->comboBox_Tfonttype->clear();
    ui->comboBox_type->clear();
    ui->comboBox_Tfonttype->addItems(QFontDatabase().families(QFontDatabase::Any));
    ui->comboBox_type->addItems(QFontDatabase().families(QFontDatabase::Any));

    //时间格式
    ui->comboBox_time->clear();
    ui->comboBox_time->addItem(tr("HH:MM"));
    ui->comboBox_time->addItem(tr("HH:MM:SS"));
    ui->comboBox_time->addItem(tr("HH-MM"));
    ui->comboBox_time->addItem(tr("HH-MM-SS"));

    //日期格式
    ui->comboBox_date->clear();
    ui->comboBox_date->addItem(tr("YYYY/MM/DD"));
    ui->comboBox_date->addItem(tr("YYYY.MM.DD"));
    ui->comboBox_date->addItem(tr("YYYY-MM-DD"));
    ui->comboBox_date->addItem(tr("MM/DD/YYYY"));
    ui->comboBox_date->addItem(tr("MM.DD.YYYY"));
    ui->comboBox_date->addItem(tr("MM-DD-YYYY"));
    ui->comboBox_date->addItem(tr("DD/MM/YYYY"));
    ui->comboBox_date->addItem(tr("DD.MM.YYYY"));
    ui->comboBox_date->addItem(tr("DD-MM-YYYY"));

    //样式
    //ui->comboBox_style->clear();
    //pwnd->OnAddPattern(ui->comboBox_style);

    //ui->label_4->hide();
    //ui->comboBox_style->hide();

    if(pItem)
    {
        QList<QGraphicsItem *> list = pItem->childItems();
        QRectF rect = pItem->sceneBoundingRect();
        QString sName = "";
        vVLine.clear();
        vHLine.clear();
        vVLine.append(rect.x());
        vHLine.append(rect.y());
        //vTileTex.clear();

        foreach(QGraphicsItem *pItem,list)
        {
            QPointF pos = pItem->boundingRect().topLeft()+pItem->scenePos();
            sName = pItem->data(GROUP_NAME_KEY).toString();
            if(sName.contains("VLine")) //垂直线
            {
                vVLine.append(pos.x());
            }
            if(sName.contains("HLine")) //水平线
            {
                vHLine.append(pos.y());
            }
        }

        for(int i = 0; i < vVLine.size(); i++)
        {
            for(int j = i + 1; j < vVLine.size(); j++)
            {
                if(vVLine.at(i) > vVLine.at(j))
                {
                    qreal odata;
                    odata = vVLine.at(i);
                    vVLine.replace(i,vVLine.at(j));
                    vVLine.replace(j,odata);
                }
            }
        }
        vVLine.append(rect.x() + rect.width());

        //横直线
        for(int i = 0; i < vHLine.size(); i++)
        {
            for(int j = i + 1; j < vHLine.size(); j++)
            {
                if(vHLine.at(i) > vHLine.at(j))
                {
                    qreal odata;
                    odata = vHLine.at(i);
                    vHLine.replace(i,vHLine.at(j));
                    vHLine.replace(j,odata);
                }
            }
        }
        vHLine.append(rect.y() + rect.height());

        int fontNum = QFontDatabase().families(QFontDatabase::Any).size();
        pSecurityWight->init(pItem);

        //标题
        ui->checkBox_number->setChecked(pItem->m_bShowId);
        ui->checkBox_time->setChecked(pItem->m_bShowTime);
        ui->comboBox_time->setCurrentIndex(pItem->m_nTimeType);
        ui->checkBox_date->setChecked(pItem->m_bShowDate);
        ui->comboBox_date->setCurrentIndex(pItem->m_nDateType);
        ui->spinBox_Tfontsize->setValue(pItem->m_nTFontSize);
        for(int i = 0; i < fontNum; i++)
        {
            if(QFontDatabase().families(QFontDatabase::Any).at(i) == pItem->m_sTFontType)
            {
                ui->comboBox_Tfonttype->setCurrentIndex(i);
                break;
            }
        }
        ui->pushButton_Tfontcolor->setStyleSheet(QString("background:%1").arg(pItem->m_nTFontColor.name()));
        ui->pushButton_BKcolor->setStyleSheet(QString("background:%1").arg(pItem->m_nTBackColor.name()));
        //填充
        ui->spinBox_transparency->setValue(pItem->m_nAlpha);
        ui->pushButton_framecolor->setStyleSheet(QString("background:%1").arg(pItem->m_nLineColor.name()));
        //ui->comboBox_style->setCurrentIndex(pItem->m_nFillCss);
        ui->pushButton_backcolor->setStyleSheet(QString("background:%1").arg(pItem->m_nBackColor.name()));
        ui->pushButton_frontcolor->setStyleSheet(QString("background:%1").arg(pItem->m_nForeColor.name()));
        //字体
        ui->spinBox_size->setValue(pItem->m_nFontSize);
        for(int i = 0; i < fontNum; i++)
        {
            if(QFontDatabase().families(QFontDatabase::Any).at(i) == pItem->m_sFontType)
            {
                ui->comboBox_type->setCurrentIndex(i);
                break;
            }
        }
        ui->pushButton_color->setStyleSheet(QString("background:%1").arg(pItem->m_nFontColor.name()));
        ui->spinBox_line->setValue(pItem->m_nRowNumber);

        //多语言,这些都没有考虑外界的语言变化的情况
        m_vecMessage = pItem->m_vecMessage;
        int vecNum   = m_vecMessage.size();
        if(vecNum > temp)
        {
            int tt = vecNum - temp;
            for(int i = 0; i < tt; i++)
            {
                m_vecMessage.pop_back();
            }
        }
        else if(vecNum < temp)
        {
            int tt = temp - vecNum;
            MmessageBoardLanguage MBLan;
            for(int i = 0; i < tt; i++)
            {
                MBLan.m_nLanguage    = vecNum + i;
                MBLan.m_sNumber      = tr("编号");
                MBLan.m_sTimeName    = tr("时间");
                MBLan.m_sDateName    = tr("日期");
                MBLan.m_sMessageName = tr("留言信息");
                m_vecMessage.push_back(MBLan);
            }
        }
        oId = pItem->id();
        ui->spinBox->setValue(oId);
    }
Exemple #28
0
CannonField::CannonField( QWidget *parent, const char *name )
        : QWidget( parent, name )
{
    ang = 45;
    setPalette( QPalette( QColor( 250, 250, 200) ) );
}
/*****************************************************************************
* CameraExample
*/
CameraExample::CameraExample(QWidget *parent) :
    QMainWindow(parent)
{
    setWindowTitle("QCameraExample");

    // Opitimizations for screen update and drawing qwidget
    setAutoFillBackground(false);

    // Prevent to screensaver to activate
    m_systemScreenSaver = new QSystemScreenSaver(this);
    m_systemScreenSaver->setScreenSaverInhibit();

    m_myVideoSurface = 0;
    pictureCaptured = false;
    showViewFinder = false;
    m_focusing = false;

    // MMS handling
    m_message = new Message(this);
    QObject::connect(m_message, SIGNAL(messageStateChanged(int)), this, SLOT(messageStateChanged(int)));
    QObject::connect(m_message, SIGNAL(messageReceived(QString,QString,QPixmap)), this, SLOT(messageReceived(QString,QString,QPixmap)));

    // Business card handling (Contact's avatar picture)
    m_businessCardHandling = new BusinessCardHandling(this);

    // Black background
    QPalette palette = this->palette();
    palette.setColor(QPalette::Background, Qt::black);
    setPalette(palette);

    // Main widget & layout
    QWidget* mainWidget = new QWidget(this);
    mainWidget->setPalette(palette);

    QHBoxLayout* hboxl = new QHBoxLayout;
    hboxl->setSpacing(0);
    hboxl->setMargin(0);

    // UI stack
    m_stackedWidget = new QStackedWidget();
    m_stackedWidget->setPalette(palette);

    // First widget to stack
    m_videoWidget = new QWidget();
    m_videoWidget->setPalette(palette);
    m_stackedWidget->addWidget(m_videoWidget);

    // Second widget to stack
    QWidget* secondWidget = new QWidget(this);
    secondWidget->setPalette(palette);
    m_stackedWidget->addWidget(secondWidget);
    m_stackedWidget->setCurrentIndex(0);

    hboxl->addWidget(m_stackedWidget);

    // Buttons
    QSize iconSize(80, 80);
    QVBoxLayout* vboxl = new QVBoxLayout;
    vboxl->setSpacing(0);
    vboxl->setMargin(0);

    // Exit button
    m_exit = new Button(this);
    QObject::connect(m_exit, SIGNAL(pressed()), qApp, SLOT(quit()));
    QPixmap p = QPixmap(":/icons/exit.png");
    m_exit->setPixmap(p.scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
    vboxl->addWidget(m_exit);
    vboxl->setAlignment(m_exit, Qt::AlignHCenter | Qt::AlignTop);

    // Camera button
    m_cameraBtn = new Button(this);
    QObject::connect(m_cameraBtn, SIGNAL(pressed()), this, SLOT(searchAndLock()));
    p = QPixmap(":/icons/camera.png");
    m_cameraBtn->setPixmap(p.scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
    vboxl->addWidget(m_cameraBtn);
    vboxl->setAlignment(m_cameraBtn, Qt::AlignCenter);

    // Send MMS button
    m_mms = new Button(this);
    QObject::connect(m_mms, SIGNAL(pressed()), this, SLOT(openContactsDlg()));
    p = QPixmap(":/icons/mms.png");
    m_mms->setPixmap(p.scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation));
    vboxl->addWidget(m_mms);
    vboxl->setAlignment(m_mms, Qt::AlignHCenter | Qt::AlignBottom);
#ifndef MESSAGING_ENABLED
    m_mms->disableBtn(true);
    m_mms->setEnabled(false);
#endif

    hboxl->addLayout(vboxl);
    mainWidget->setLayout(hboxl);

    setCentralWidget(mainWidget);

    // Enable camera after 1s, so that the application is started
    // and widget is created to landscape orientation
    QTimer::singleShot(1000,this,SLOT(enableCamera()));
}
Exemple #30
0
QOverlay::QOverlay(QWidget *parent) : QWidget(parent), _parent(parent)
{
  setPalette(Qt::transparent);
  if(parent)
    parent->installEventFilter(this);
}