QT_USE_NAMESPACE PortSettingsWindow::PortSettingsWindow(QWidget *parent) : QDialog(parent), ui(new Ui::PortSettingsWindow) { ui->setupUi(this); intValidator = new QIntValidator(0,40000000,this); //ograniczy zakres możliwych do wprowadzenia prędkośći ui->comboBox_baudRate->setInsertPolicy(QComboBox::NoInsert); connect(ui->pushButton_apply,SIGNAL(clicked()),this,SLOT(apply())); connect(ui->comboBox_Port,SIGNAL(currentIndexChanged(int)),this,SLOT(showPortInfo(int))); connect(ui->comboBox_baudRate,SIGNAL(currentIndexChanged(int)),this,SLOT(checkCustomBaudRatePolicy(int))); connect(ui->pushButton_refresh,SIGNAL(clicked()),this,SLOT(fillPortsInfo())); fillPortsParameters(); fillPortsInfo(); updateSettings(); }
QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WindowFlags f ) : QDialog( tool->canvas()->topLevelWidget(), f ), mTool( tool ) { setupUi( this ); QPushButton *nb = new QPushButton( tr( "&New" ) ); buttonBox->addButton( nb, QDialogButtonBox::ActionRole ); connect( nb, SIGNAL( clicked() ), this, SLOT( restart() ) ); mMeasureArea = tool->measureArea(); mTotal = 0.; // Set one cell row where to update current distance // If measuring area, the table doesn't get shown QTreeWidgetItem* item = new QTreeWidgetItem( QStringList( QString::number( 0, 'f', 1 ) ) ); item->setTextAlignment( 0, Qt::AlignRight ); mTable->addTopLevelItem( item ); updateSettings(); }
KisShadeSelectorLineComboBox::KisShadeSelectorLineComboBox(QWidget *parent) : QComboBox(parent), m_private(new KisShadeSelectorLineComboBoxPrivate(this)), m_currentLine(new KisShadeSelectorLine(0,0,0,this)) { QGridLayout* l = new QGridLayout(this); l->addWidget(m_currentLine); m_currentLine->setEnabled(false); m_currentLine->setColor(QColor(190,50,50)); // 30 pixels for the arrow of the combobox // setMinimumWidth(m_private->selectorWidth+m_private->spacing+30); // setMaximumWidth(minimumWidth()); // m_currentLine->setMaximumWidth(m_private->selectorWidth); // setMaximumHeight(QWIDGETSIZE_MAX); updateSettings(); }
int main(int argc, char** argv) { // setup basic vehicles initBaseVehicles(); tbb::parallel_invoke( [] { // accept connection startNetwork(8866); }, [] { // run simulation while(1) { // handle the move phase updateSettings(); updateLocations(); processCollisions(); } } ); }
QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea ) : QgsMapTool( canvas ) { mMeasureArea = measureArea; mRubberBand = new QgsRubberBand( canvas, mMeasureArea ); QPixmap myCrossHairQPixmap = QPixmap(( const char ** ) cross_hair_cursor ); mCursor = QCursor( myCrossHairQPixmap, 8, 8 ); mDone = true; // Append point we will move mPoints.append( QgsPoint( 0, 0 ) ); mDialog = new QgsMeasureDialog( this ); mSnapper.setMapCanvas( canvas ); connect( canvas->mapRenderer(), SIGNAL( destinationSrsChanged() ), this, SLOT( updateSettings() ) ); }
PrefWidget * KDBSearchEngine2::preferencesWidget(QWidget *parent) { pw = new KDB2PreferencesWidget(parent); kdDebug(0) << "new KDB2 preferences widget" << endl; setSettings(); connect(pw,SIGNAL(restoreNow()),this,SLOT(setSettings())); connect(pw,SIGNAL(applyNow()),this,SLOT(updateSettings())); connect(pw,SIGNAL(destroyed()),this,SLOT(prefDestr())); connect(pw->dbpw->scanAll,SIGNAL(clicked()),this,SLOT(scanAllPressed())); connect(pw->dbpw->scanSource,SIGNAL(clicked()),this,SLOT(scanNowPressed())); connect(pw->dbpw->addSource,SIGNAL(clicked()),this,SLOT(addSource())); connect(pw->dbpw->editSource,SIGNAL(clicked()),this,SLOT(editSource())); connect(pw->dbpw->removeSource,SIGNAL(clicked()),this,SLOT(removeSource())); return pw; }
QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool *tool, Qt::WindowFlags f ) : QDialog( tool->canvas()->topLevelWidget(), f ) , mTool( tool ) { setupUi( this ); QPushButton *nb = new QPushButton( tr( "&New" ) ); buttonBox->addButton( nb, QDialogButtonBox::ActionRole ); connect( nb, &QAbstractButton::clicked, this, &QgsMeasureDialog::restart ); // Add a configuration button QPushButton *cb = new QPushButton( tr( "&Configuration" ) ); buttonBox->addButton( cb, QDialogButtonBox::ActionRole ); connect( cb, &QAbstractButton::clicked, this, &QgsMeasureDialog::openConfigTab ); mMeasureArea = tool->measureArea(); mTotal = 0.; repopulateComboBoxUnits( mMeasureArea ); if ( mMeasureArea ) mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( QgsProject::instance()->areaUnits() ) ); else mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( QgsProject::instance()->distanceUnits() ) ); if ( !mTool->canvas()->mapSettings().destinationCrs().isValid() ) { mUnitsCombo->setEnabled( false ); if ( mMeasureArea ) mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( QgsUnitTypes::DistanceUnknownUnit ) ); else mUnitsCombo->setCurrentIndex( mUnitsCombo->findData( QgsUnitTypes::AreaUnknownUnit ) ); } updateSettings(); connect( mUnitsCombo, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &QgsMeasureDialog::unitsChanged ); connect( buttonBox, &QDialogButtonBox::rejected, this, &QgsMeasureDialog::reject ); connect( mTool->canvas(), &QgsMapCanvas::destinationCrsChanged, this, &QgsMeasureDialog::crsChanged ); groupBox->setCollapsed( true ); }
DialogSettings::DialogSettings(QWidget *parent) : QDialog(parent), ui(new Ui::DialogSettings), settingsCore(std::make_shared<Settings::Core>()) { setWindowFlags(windowFlags()); ui->setupUi(this); auto profileWindow = new ProfileWindow(std::make_shared<Settings::SliderPackageFactory>(), nullptr); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(updateSettings())); connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject())); ui->tabCommon->setLayout(new QVBoxLayout()); ui->tabProfile->setLayout(new QVBoxLayout()); ui->tabCommon->layout()->addWidget(settingsCore->settingsWidget()); ui->tabProfile->layout()->addWidget(profileWindow); WidgetSizeKeeper::load(this, "SettingsDialog"); }
LibraryModel::LibraryModel(QObject *parent) : QAbstractItemModel(parent), _root(nullptr), _db("libraryModel", this), _elementsList(_db.dbObject()) { _headers << tr("Name") << tr("Status") << tr("Results") << tr("Infos"); _noResultsColor = QColor(Qt::gray); _noResultsColor.setAlpha(30); _missingColor = QColor(Qt::red); _missingColor.setAlpha(60); _searchedColor = QColor(254, 183, 11, 50); _trackLinkedColor = QColor(Qt::green); _trackLinkedColor.setAlpha(50); _elementsList.prepare("SELECT * FROM LibraryHelper ORDER BY filePath"); updateSettings(); }
void EmuSettings::continueClicked() { if( settingsChanged ) { savecurrentSettings(); emit( updateSettings(gpspsettings) ); settingsChanged = false; } //if there was no ROM loaded, load previous ROM if( !romloaded ) { emit( LoadROM( gpspsettings.iLastROM, gpspsettings )); romloaded = true; } //just continue the game else { emit( continueGame() ); } }
QgsMeasureTool::QgsMeasureTool( QgsMapCanvas* canvas, bool measureArea ) : QgsMapTool( canvas ) { mMeasureArea = measureArea; mRubberBand = new QgsRubberBand( canvas, mMeasureArea ? QGis::Polygon : QGis::Line ); mRubberBandPoints = new QgsRubberBand( canvas, QGis::Point ); QPixmap myCrossHairQPixmap = QPixmap(( const char ** ) cross_hair_cursor ); mCursor = QCursor( myCrossHairQPixmap, 8, 8 ); mDone = true; // Append point we will move mPoints.append( QgsPoint( 0, 0 ) ); mDialog = new QgsMeasureDialog( this, Qt::WindowStaysOnTopHint ); mDialog->restorePosition(); connect( canvas, SIGNAL( destinationCrsChanged() ), this, SLOT( updateSettings() ) ); }
QT_USE_NAMESPACE SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { ui->setupUi(this); intValidator = new QIntValidator(0, 4000000, this); ui->baudRateBox->setInsertPolicy(QComboBox::NoInsert); connect(ui->applyButton, SIGNAL(clicked()),this, SLOT(apply())); connect(ui->serialPortInfoListBox, SIGNAL(currentIndexChanged(int)),this, SLOT(showPortInfo(int))); connect(ui->baudRateBox, SIGNAL(currentIndexChanged(int)),this, SLOT(checkCustomBaudRatePolicy(int))); fillPortsParameters(); fillPortsInfo(); updateSettings(); }
SerialSettingDialog::SerialSettingDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SerialSettingDialog) { ui->setupUi(this); setWindowTitle("Configure Serial Port"); serial = new QSerialPort(this); intValidator = new QIntValidator(0, 4000000, this); ui->BaudRate_Box->setInsertPolicy(QComboBox::NoInsert); initConnections(); fillPortsInfo(); fillPortsParameters(); updateSettings(); console = new SerialConsole; console->setEnabled(false); ui->horizontalLayout->addWidget(console); }
void GameHandler::processAllGames(void) { checkHandlers(); QStringList updatelist; for (int x = 0; x < handlers->size(); x++) { GameHandler *handler = handlers->at(x); if (handler) { updateSettings(handler); handler->processGames(handler); if (handler->needRebuild()) updatelist.append(handler->GameType()); } } if (!updatelist.isEmpty()) UpdateGameCounts(updatelist); }
void RemoveRedEyesWindow::writeSettings() { updateSettings(); KConfig config("kipirc"); KConfigGroup group = config.group(d->configGroupName); if (d->hasLocator) { group.writeEntry(d->configLocatorTypeEntry, d->locator->objectName()); } group.writeEntry(d->configStorageModeEntry, d->settings.storageMode); group.writeEntry(d->configUnprocessedModeEntry, d->settings.unprocessedMode); group.writeEntry(d->configExtraNameEntry, d->settings.extraName); group.writeEntry(d->configAddkeywordEntry, d->settings.addKeyword); group.writeEntry(d->configKeywordNameEntry, d->settings.keywordName); KConfigGroup dialogGroup = config.group("RemoveRedEyes Dialog"); KWindowConfig::saveWindowSize(windowHandle(), dialogGroup); config.sync(); }
void GenericEditor::update() { std::cout << "Editor for "; GenericProcessor* p = (GenericProcessor*) getProcessor(); std::cout << p->getName() << " updating settings." << std::endl; int numChannels; if (channelSelector != 0) { if (!p->isSink()) numChannels = p->getNumOutputs(); else numChannels = p->getNumInputs(); channelSelector->setNumChannels(numChannels); } if (numChannels == 0) { if (drawerButton != 0) drawerButton->setVisible(false); } else { if (drawerButton != 0) drawerButton->setVisible(true); } updateSettings(); updateVisualizer(); // does nothing unless this method // has been implemented }
void Desktopwidget::slotUpdateRepositoryList (QString &dirname, bool add_not_delete) { err_info *err = NULL; if (add_not_delete) err = addDir (dirname); else { QModelIndex index = _model->index (dirname, 0); if (index != QModelIndex ()) { _contents->removeDesk (dirname); _model->removeDirFromList (index); _contents->resetDirPath (); } else qDebug () << "slotUpdateRepositoryList: Could not find dirname" << dirname << "in model index: "; } if (!err_complain (err)) updateSettings (); }
KisCommonColors::KisCommonColors(QWidget *parent) : KisColorPatches("commonColors", parent) { m_reloadButton = new QPushButton(); m_reloadButton->setIcon(koIcon("view-refresh")); connect(m_reloadButton, SIGNAL(clicked()), this, SLOT(recalculate())); QList<QWidget*> tmpList; tmpList.append(m_reloadButton); setAdditionalButtons(tmpList); updateSettings(); m_recalculationTimer.setInterval(2000); m_recalculationTimer.setSingleShot(true); m_delayUpdateTimer.setInterval(1); m_delayUpdateTimer.setSingleShot(true); connect(&m_recalculationTimer, SIGNAL(timeout()), this, SLOT(recalculate())); connect(&m_delayUpdateTimer, SIGNAL(timeout()), this, SLOT(updateColors())); }
void Sound::create (Movable *parent) { Ogre::SceneManager *mSceneMgr = RadXML::getSingletonPtr ()->getSceneManager (); if (load == true) { sSound = new RadXmlCommon::s13Sound (); sSound->strPath = file; sSound->bStreaming = streaming; sSound->dGain = gain; sSound->LoadPath (); if (sSound->IsLoaded () == false) RadXmlCommon::s13LogMessage ("Unable to load audio file: " + file); if (bPlay == true) sSound->Play (); } /// @note Create the SceneNode here and keep it updated. updateSettings (); setParent (parent); }
ConnectDialog::ConnectDialog(QWidget *parent) : QDialog(parent), m_ui(new Ui::ConnectDialog), m_customSpeedValidator(0) { m_ui->setupUi(this); m_customSpeedValidator = new QIntValidator(0, 1000000, this); m_ui->errorFilterEdit->setValidator(new QIntValidator(0, 0x1FFFFFFFU, this)); m_ui->loopbackBox->addItem(tr("unspecified"), QVariant()); m_ui->loopbackBox->addItem(tr("false"), QVariant(false)); m_ui->loopbackBox->addItem(tr("true"), QVariant(true)); m_ui->receiveOwnBox->addItem(tr("unspecified"), QVariant()); m_ui->receiveOwnBox->addItem(tr("false"), QVariant(false)); m_ui->receiveOwnBox->addItem(tr("true"), QVariant(true)); m_ui->canFdBox->addItem(tr("false"), QVariant(false)); m_ui->canFdBox->addItem(tr("true"), QVariant(true)); connect(m_ui->okButton, &QPushButton::clicked, this, &ConnectDialog::ok); connect(m_ui->cancelButton, &QPushButton::clicked, this, &ConnectDialog::cancel); connect(m_ui->useConfigurationBox, &QCheckBox::clicked, m_ui->configurationBox, &QGroupBox::setEnabled); connect(m_ui->speedBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &ConnectDialog::checkCustomSpeedPolicy); connect(m_ui->backendListBox, &QComboBox::currentTextChanged, this, &ConnectDialog::backendChanged); m_ui->rawFilterEdit->hide(); m_ui->rawFilterLabel->hide(); fillBackends(); fillSpeeds(); updateSettings(); }
void RbUtilQt::downloadBleedingDone(bool error) { if(error) { qDebug() << "[RbUtil] network error:" << bleeding->error(); ui.statusbar->showMessage(tr("Can't get version information!")); QMessageBox::critical(this, tr("Network error"), tr("Can't get version information.\n" "Network error: %1. Please check your network and proxy settings.") .arg(bleeding->errorString())); return; } else { bleedingInfo.open(); ServerInfo::readBleedingInfo(bleedingInfo.fileName()); bleedingInfo.close(); ui.statusbar->showMessage(tr("Download build information finished."), 5000); updateSettings(); m_gotInfo = true; //start check for updates checkUpdate(); } }
SettingsDialog::SettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SettingsDialog) { ui->setupUi(this); intValidator = new QIntValidator(0, 4000000, this); ui->baudRateBox->setInsertPolicy(QComboBox::NoInsert); connect(ui->applyButton, &QPushButton::clicked, this, &SettingsDialog::apply); connect(ui->serialPortInfoListBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDialog::showPortInfo); connect(ui->baudRateBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDialog::checkCustomBaudRatePolicy); connect(ui->serialPortInfoListBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &SettingsDialog::checkCustomDevicePathPolicy); fillPortsParameters(); fillPortsInfo(); updateSettings(); }
void EmuSettings::continueClicked() { if( settingsChanged ) { savecurrentSettings(); emit( updateSettings(gpspsettings) ); settingsChanged = false; } //if there was no ROM loaded, load previous ROM if( !romloaded ) { //sanitycheck that we actually have a ROM to load if( gpspsettings.iLastROM.length() < 3 ) return; emit( LoadROM( gpspsettings.iLastROM, gpspsettings )); romloaded = true; } //just continue the game else { emit( continueGame() ); } }
RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) { // startup log qDebug() << "======================================"; qDebug() << "[System] Rockbox Utility " VERSION; qDebug() << "[System] Qt version:" << qVersion(); qDebug() << "======================================"; absolutePath = qApp->applicationDirPath(); HttpGet::setGlobalUserAgent("rbutil/"VERSION); // init startup & autodetection ui.setupUi(this); updateSettings(); downloadInfo(); m_gotInfo = false; m_auto = false; // manual tab ui.radioPdf->setChecked(true); // info tab ui.treeInfo->setAlternatingRowColors(true); ui.treeInfo->setHeaderLabels(QStringList() << tr("File") << tr("Version")); ui.treeInfo->expandAll(); ui.treeInfo->setColumnCount(2); ui.treeInfo->setLayoutDirection(Qt::LeftToRight); // disable quick install until version info is available ui.buttonSmall->setEnabled(false); ui.buttonComplete->setEnabled(false); ui.actionSmall_Installation->setEnabled(false); ui.actionComplete_Installation->setEnabled(false); connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(updateTabs(int))); connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt())); connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about())); connect(ui.action_Help, SIGNAL(triggered()), this, SLOT(help())); connect(ui.action_Configure, SIGNAL(triggered()), this, SLOT(configDialog())); connect(ui.buttonChangeDevice, SIGNAL(clicked()), this, SLOT(configDialog())); connect(ui.buttonRockbox, SIGNAL(clicked()), this, SLOT(installBtn())); connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBootloaderBtn())); connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFontsBtn())); connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoomBtn())); connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles())); connect(ui.buttonCreateVoice, SIGNAL(clicked()), this, SLOT(createVoiceFile())); connect(ui.buttonVoice, SIGNAL(clicked()), this, SLOT(installVoice())); connect(ui.buttonThemes, SIGNAL(clicked()), this, SLOT(installThemes())); connect(ui.buttonRemoveRockbox, SIGNAL(clicked()), this, SLOT(uninstall())); connect(ui.buttonRemoveBootloader, SIGNAL(clicked()), this, SLOT(uninstallBootloader())); connect(ui.buttonDownloadManual, SIGNAL(clicked()), this, SLOT(downloadManual())); connect(ui.buttonSmall, SIGNAL(clicked()), this, SLOT(smallInstall())); connect(ui.buttonComplete, SIGNAL(clicked()), this, SLOT(completeInstall())); // actions accessible from the menu connect(ui.actionComplete_Installation, SIGNAL(triggered()), this, SLOT(completeInstall())); connect(ui.actionSmall_Installation, SIGNAL(triggered()), this, SLOT(smallInstall())); connect(ui.actionInstall_Bootloader, SIGNAL(triggered()), this, SLOT(installBootloaderBtn())); connect(ui.actionInstall_Rockbox, SIGNAL(triggered()), this, SLOT(installBtn())); connect(ui.actionFonts_Package, SIGNAL(triggered()), this, SLOT(installFontsBtn())); connect(ui.actionInstall_Themes, SIGNAL(triggered()), this, SLOT(installThemes())); connect(ui.actionInstall_Game_Files, SIGNAL(triggered()), this, SLOT(installDoomBtn())); connect(ui.actionInstall_Voice_File, SIGNAL(triggered()), this, SLOT(installVoice())); connect(ui.actionCreate_Voice_File, SIGNAL(triggered()), this, SLOT(createVoiceFile())); connect(ui.actionCreate_Talk_Files, SIGNAL(triggered()), this, SLOT(createTalkFiles())); connect(ui.actionRemove_bootloader, SIGNAL(triggered()), this, SLOT(uninstallBootloader())); connect(ui.actionUninstall_Rockbox, SIGNAL(triggered()), this, SLOT(uninstall())); connect(ui.action_System_Info, SIGNAL(triggered()), this, SLOT(sysinfo())); connect(ui.action_Trace, SIGNAL(triggered()), this, SLOT(trace())); #if !defined(STATIC) ui.actionInstall_Rockbox_Utility_on_player->setEnabled(false); #else connect(ui.actionInstall_Rockbox_Utility_on_player, SIGNAL(triggered()), this, SLOT(installPortable())); #endif }
void AudioSettings::onOKButtonClicked() { updateSettings(); close(); }
void UsageStatsPlugin::pluginsLoadEnded() { updateSettings(); }
void GlobalSettingsConfig::showEvent(QShowEvent* e) { QDialog::showEvent(e); updateSettings(); }
void RbUtilQt::configDialog() { Config *cw = new Config(this); connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings())); cw->show(); }
//---------------------------------------------------------------------------- bool Video::update( void) { // XTRACE(); static float nextTime = Timer::getTime()+0.5f; float thisTime = Timer::getTime(); if( thisTime > nextTime) { updateSettings(); nextTime = thisTime+0.5f; } if( _maxFPS) { static float sTime = Timer::getTime(); if( (thisTime-sTime) < _fpsStepSize) { return true; } while(( thisTime-sTime) > _fpsStepSize) sTime+=_fpsStepSize; } FPS::Update(); GLBitmapFont &smallFont = *_smallFont; GLBitmapFont &scoreFont = *_scoreFont; GLBitmapFont &gameOFont = *_gameOFont; glEnable( GL_DEPTH_TEST); glEnable( GL_LIGHTING); glEnable( GL_LIGHT0); glShadeModel(GL_SMOOTH); glEnable( GL_NORMALIZE); // glEnable( GL_RESCALE_NORMAL); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glEnable( GL_COLOR_MATERIAL ); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); const float fov = 53.13f; glFrustum( (4.0/3.0)*(-2.0*tan(53.13 * M_PI / 360.0)), //xmin (4.0/3.0)*( 2.0*tan(53.13 * M_PI / 360.0)), //xmax -2.0*tan(53.13 * M_PI / 360.0), //ymin 2.0*tan(53.13 * M_PI / 360.0), //ymax 2.0, //znear 1000.0); //zfar glMatrixMode(GL_MODELVIEW); glLoadIdentity(); CameraS::instance()->update(); //place camera CameraS::instance()->place(); GLfloat light_position[] = { 20.0, 0.0, -50.0, 1.0 }; glLightfv(GL_LIGHT0, GL_POSITION, light_position); glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); if( GameState::isDeveloper) { //highlight the playing field, useful when using mouselook glDisable( GL_DEPTH_TEST); glDisable( GL_LIGHTING); float y = tan(((float)M_PI*fov)/360.0f)*100; float x = y*4.0f/3.0f; glColor4f( 1.0f, 1.0f, 1.0f, 0.1f ); glBegin(GL_QUADS); glVertex3f( -x, y, -100); glVertex3f( x, y, -100); glVertex3f( x,-y, -100); glVertex3f( -x,-y, -100); glEnd(); glEnable( GL_LIGHTING); glEnable( GL_DEPTH_TEST); } // stars are not shown in planet menu ContextEnum context = GameS::instance()->getContext(); if (context != ePlanetMenu) StarfieldS::instance()->draw( _showStarfield, _showNebulas); float hyspace = GameS::instance()->_hyperspaceCount; int countdown = -1; if (hyspace != 0) countdown = (int)(GameState::stopwatch.getTime() - hyspace); if (context == eInGame || context == ePaused) { if (HeroS::instance()->alive()) { glPushMatrix(); HeroS::instance()->draw(); glPopMatrix(); } if (hyspace == 0 || countdown < 10) ParticleGroupManagerS::instance()->draw(); } //--- Ortho stuff from here on --- glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-0.5,VIDEO_ORTHO_WIDTH+0.5,-0.5,VIDEO_ORTHO_HEIGHT+0.5, -1000.0, 1000.0); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glDisable(GL_DEPTH_TEST); glDisable(GL_LIGHTING); if (HeroS::instance()->alive() && (context == eInGame || context == ePaused)) { if (context == ePaused) { glColor4f(1.0f,1.0f,1.0f,0.9f); smallFont.DrawString("PAUSED", 500, 300, 1.0f, 1.0f, GLBitmapFont::alCenter); } if (hyspace != 0) { if (countdown < 10) { glColor4f(1.0f,0.5f,0.0f,0.4f); char buff[100]; sprintf(buff, "Hyperspace jump in %d seconds", 10 - countdown); smallFont.DrawString(buff, 500, 400, 1.0f, 1.0f, GLBitmapFont::alCenter); } if (countdown > 15) { glColor4f(0.2f,0.9f,1.0f,0.8f); char buff[100]; Planet *ph = PlanetManagerS::instance()->getHyperspaceTarget(); sprintf(buff, "Reaching %s orbit", ph->_name.c_str()); smallFont.DrawString(buff, 500, 400, 1.0f, 1.0f, GLBitmapFont::alCenter); } } else { if (GameS::instance()->_spaceStationApproach != 0) { glColor4f(1.0f,1.0f,0.3f,0.8f); smallFont.DrawString("Approaching Space Station", 500, 400, 1.0f, 1.0f, GLBitmapFont::alCenter); } else if (GameS::instance()->getHyperspaceAvailable() == "OK") { glColor4f(1.0f,1.0f,1.0f,0.6f); string hskey = InputS::instance()->getKeyForAction("HyperSpace"); if (hskey == "NONE!!!") hskey = "Hyperspace key not set! Please re-configure the keyboard."; else hskey = "Press " + hskey + " for hyperspace jump"; smallFont.DrawString(hskey.c_str(), 500, 600, 1.0f, 1.0f, GLBitmapFont::alCenter); } } } glColor4f(1.0,1.0,1.0,1.0); if (context != ePlanetMenu) { bool showFPS = false; ConfigS::instance()->getBoolean( "showFPS", showFPS); if (showFPS) { float ypos = 3.0f; if (context == eInGame || context == ePaused) ypos = 70.0f; smallFont.DrawString(FPS::GetFPSString(), 3.0f, ypos, 0.6f, 0.6f, GLBitmapFont::alLeft); } } if (context == eInGame || context == ePaused) { if (!HeroS::instance()->alive()) { glColor4f(1.0f,1.0f,1.0f,0.8f); gameOFont.DrawString( "GAME OVER" , 80, 320, 1.3f, 1.3f); glColor4f(1.0f,0.0f,0.0f,0.8f); smallFont.DrawString( "You are fried by the Scum of the Universe" , 170, 260, 1.0f, 1.0f); string escmsg = "Press ESC to exit"; glColor4f(1.0f,0.852f,0.0f,1.0f); smallFont.DrawString(escmsg.c_str() , 500, 140, 1.0f, 1.0f, GLBitmapFont::alCenter); glColor4f(1.0f,1.0f,1.0f,1.0f); } } char buff[128]; if( GameState::isDeveloper) { static float nextShow = 0; static int aCount = 0; float thisTime = Timer::getTime(); if( thisTime > nextShow) { nextShow = thisTime + 0.5f; aCount = ParticleGroupManagerS::instance()->getAliveCount(); } sprintf( buff, "p=%d", aCount); smallFont.DrawString( buff, 0, 40, 1.0, 1.0); } if (context == eMenu) { glEnable(GL_TEXTURE_2D); float z=-1.0; float dx= 1.0/512.0; _titleA->bind(); glBegin(GL_QUADS); glTexCoord2f( dx ,dx ); glVertex3f(350,740, z); glTexCoord2f( 1.0f-dx,dx ); glVertex3f(500,740, z); glTexCoord2f( 1.0f-dx,1-dx ); glVertex3f(500,560, z); glTexCoord2f( dx ,1-dx ); glVertex3f(350,560, z); glEnd(); _titleB->bind(); glBegin(GL_QUADS); glTexCoord2f( dx ,dx ); glVertex3f(500,740, z); glTexCoord2f( 1.0f-dx,dx ); glVertex3f(650,740, z); glTexCoord2f( 1.0f-dx,1-dx ); glVertex3f(650,560, z); glTexCoord2f( dx ,1-dx ); glVertex3f(500,560, z); glEnd(); glDisable(GL_TEXTURE_2D); MenuManagerS::instance()->draw(); } else if (context == ePlanetMenu) { PlanetManagerS::instance()->draw(); } else if (context == eMessageBox) { MessageBoxManagerS::instance()->draw(); } else // InGame, Paused, MouseLook { if (_boardVisible) { const float size = 0.48f; // classic const float weapon_start_x = 975.0f; const float weapon_start_y = 22.0f; glColor4f( 1.0f, 0.7f, 0.0f, 0.6f ); scoreFont.DrawString( "POINTS:", 5.0f, 725.0f, size, size); scoreFont.DrawString( "KILLS:", 5.0f, 700.0f, size, size); sprintf (buff, "%d", ScoreKeeperS::instance()->getCurrentScore()); scoreFont.DrawString( buff, 100.0f, 725.0f, size, size); sprintf (buff, "%d", GameS::instance()->_kills); scoreFont.DrawString( buff, 100.0f, 700.0f, size, size); float he = HeroS::instance()->getEnergy(); if (he < 0.0f) he = 0.0f; glColor4f( 1.0f, 1.0f, 1.0f, 0.3f ); glBegin(GL_QUADS); glVertex3f( 45.0f, 15.0f, -1); glVertex3f( 142.0f, 15.0f, -1); glVertex3f( 142.0f, 33.0f, -1); glVertex3f( 45.0f, 33.0f, -1); glEnd(); if (he >= 100.0f) glColor4f( 0.0f, 0.5f, 1.0f, 0.7f ); else glColor4f( 1.0f, 0.0f, 0.0f, 0.7f ); glBegin(GL_QUADS); glVertex3f( 45.0f , 15.0f, -1); glVertex3f( 45.0f+he*.97f, 15.0f, -1); glVertex3f( 45.0f+he*.97f, 33.0f, -1); glVertex3f( 45.0f , 33.0f, -1); glEnd(); glColor4f(1.0,1.0,1.0,0.9f); sprintf( buff, "%d", (int)he); scoreFont.DrawString( buff, 45.0f, 13.0f, size, size); float se = HeroS::instance()->getShieldEnergy(); float seclip = se; CargoItem *item = GameS::instance()->_cargo.findItem("Shield upgrade"); if (item && item->_quantity > 0) seclip *= 0.5; glColor4f( 1.0f, 1.0f, 1.0f, 0.3f ); glBegin(GL_QUADS); glVertex3f( 45.0f, 47.0f, -1); glVertex3f( 142.0f, 47.0f, -1); glVertex3f( 142.0f, 65.0f, -1); glVertex3f( 45.0f, 65.0f, -1); glEnd(); if (se >= 100.0f) glColor4f( 1.0f, 0.7f, 0.0f, 0.6f ); else glColor4f( 1.0f, 0.0f, 0.0f, 0.7f ); glBegin(GL_QUADS); glVertex3f( 45.0f , 47.0f, -1); glVertex3f( 45.0f+seclip*.97f , 47.0f, -1); glVertex3f( 45.0f+seclip*.97f , 65.0f, -1); glVertex3f( 45.0f , 65.0f, -1); glEnd(); glColor4f(1.0,1.0,1.0,0.9f); sprintf( buff, "%d", (int)se); scoreFont.DrawString( buff, 45.0f, 45.0f, size, size); const float spacing = 40.0f; const float redge = 1020.0f; const float top = 730.0f; if (hyspace == 0 || countdown < 10) { int data[3]; StageManagerS::instance()->getCounts(data[0], data[1], data[2]); glColor4f(1.0f, 1.0f, 1.0f, 0.9f); for (int ix = 0; ix < 3; ++ix) { sprintf(buff, "%d", data[ix]); scoreFont.DrawString(buff, redge - (3-ix)*spacing, top - 40, 0.48f, 0.48f, GLBitmapFont::alCenter); } } float xoffset1 = weapon_start_x; bool weaponsStarted1 = false; std::vector<CargoItemInfo> *info = CargoItemInfo::getCargoInfo(); for (std::vector<CargoItemInfo>::iterator it = info->begin(); it != info->end(); ++it) { if ((*it)._name == "Shield upgrade") break; if ((*it)._name == "Proton enhancer") weaponsStarted1 = true; if (!weaponsStarted1) continue; CargoItem *c = GameS::instance()->_cargo.findItem((*it)._name); if (c && c->_quantity > 0) { if ((*it)._maxQty > 1) { glColor4f(1.0f, 1.0f, 1.0f, 0.9f); sprintf(buff, "%d", c->_quantity); scoreFont.DrawString(buff, xoffset1, 40.0f, 0.48f, 0.48f, GLBitmapFont::alCenter); } xoffset1 -= 45; } } glEnable (GL_LIGHTING); glEnable (GL_DEPTH_TEST); GLfloat light_position2[] = { 820.0, 620.0, 500.0, 0.0 }; glLightfv(GL_LIGHT0, GL_POSITION, light_position2); glDisable(GL_TEXTURE_2D); float iAngle = _prevAngle+(_angle-_prevAngle)*GameState::frameFraction; // shield and energy static Model *energy = ModelManagerS::instance()->getModel("models/EnergyBlob"); glPushMatrix(); glTranslatef(22.0f, 22.0f, 1.0); //glRotatef(-90.0f, 1.0, 0.0, 0.0); glRotatef(iAngle * 0.5, 1.0, 0.0, 0.0); glScalef(4.5f, 4.5f, 4.5f); energy->draw(); glPopMatrix(); static Model *shield = ModelManagerS::instance()->getModel("models/ShieldBoost"); glPushMatrix(); glTranslatef(22.0f, 50.0f, 1.0); //glRotatef(-90.0f, 1.0, 0.0, 0.0); glRotatef(iAngle * 0.5, 0.0, 1.0, 0.0); glScalef(4.5f, 4.5f, 4.5f); shield->draw(); glPopMatrix(); // draw images of incoming enemies ------------------------------- if (hyspace == 0 || countdown < 10) { static Model *alien = ModelManagerS::instance()->getModel("models/SixLegBugYellow"); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glPushMatrix(); glTranslatef(redge - 3*spacing, top, 1.0); glRotatef(-90.0f, 1.0, 0.0, 0.0); glRotatef(iAngle, 0.0, 0.0, 1.0); glScalef(6.0f, 6.0f, 6.0f); alien->draw(); glPopMatrix(); static Model *empire = ModelManagerS::instance()->getModel("models/DarkAngel"); glPushMatrix(); glTranslatef(redge - 2*spacing, top, 1.0); glRotatef(-15.0f, 1.0, 0.0, 0.0); glRotatef(iAngle, 0.0, 1.0, 0.0); glScalef(6.0f, 6.0f, 6.0f); empire->draw(); glPopMatrix(); static Model *rebel = ModelManagerS::instance()->getModel("models/BigFoot"); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glPushMatrix(); glTranslatef(redge - spacing, top, 1.0); glRotatef(iAngle, 0.0, 1.0, 0.0); glScalef(6.0f, 6.0f, 6.0f); rebel->draw(); glPopMatrix(); } // draw weapons float yoffset = weapon_start_y; float xoffset = weapon_start_x; bool weaponsStarted = false; for (std::vector<CargoItemInfo>::iterator it = info->begin(); it != info->end(); ++it) { if ((*it)._name == "Shield upgrade") break; if ((*it)._name == "Proton enhancer") weaponsStarted = true; if (!weaponsStarted) continue; CargoItem *c = GameS::instance()->_cargo.findItem((*it)._name); if (c && c->_quantity > 0) { Model *m = ModelManagerS::instance()->getModel((*it)._modelName); glColor4f(1.0f, 1.0f, 1.0f, 1.0f); glPushMatrix(); glTranslatef(xoffset, yoffset, 1.0); glRotatef(iAngle * 0.5f + yoffset, 0.0, 1.0, 0.0); glScalef((*it)._scale, (*it)._scale, (*it)._scale); m->draw(); glPopMatrix(); xoffset -= 45; } } } } SDL_GL_SwapBuffers( ); return true; }
void UdpServerThread::processPendingDatarams() { QByteArray data; do{ data.resize(m_udpServer.pendingDatagramSize()); m_udpServer.readDatagram(data.data(),data.size()); }while(m_udpServer.hasPendingDatagrams()); QDataStream in(&data,QIODevice::ReadOnly); in.setVersion(QDataStream::Qt_4_8); AzSocketInfo sockInfo; AzIrisInfo irisInfo; //quint16 cmdHead; //qint8 command; //quint16 datasize; ConfigSettings *settings; QByteArray qbaHostAddress; QByteArray qbaDeviceSN; in>>sockInfo.commandHead>>sockInfo.command>>sockInfo.dataSize; QT_TRY{ if(QString::number(sockInfo.commandHead,16)=="ccff") { switch(sockInfo.command) { case 0x01://setting settings= new ConfigSettings(); in>>settings->pid>>qbaDeviceSN>>qbaHostAddress>>settings->port>>settings->seriesId>>settings->mode>>settings->allowSwitchMode >>settings->allowEnroll; settings->deviceSN=QString::fromAscii(qbaDeviceSN); settings->hostAddress=QString::fromAscii(qbaHostAddress); emit updateSettings(settings); qDebug()<<"CC-FF-01"; break; case 0x02://personinfo irisInfo.command = sockInfo.command; irisInfo.dataSize = sockInfo.dataSize; in>>irisInfo.personId>>irisInfo.if_UserNo>>irisInfo.leftIrisTemplate >>irisInfo.rightIrisTemplate; irisInfo.commandHead = QString::number(sockInfo.commandHead,16).toUpper(); qDebug()<<irisInfo.commandHead<<quint8(0x02); emit readingDatagrams(irisInfo); break; case 0x03: //Enroll 注册人员 dzrun.enrollMode = true; in>>irisInfo.pid>>irisInfo.personId>>irisInfo.if_UserNo; dzrun.enrollPerson->personId = irisInfo.personId; dzrun.enrollPerson->if_UserNo = irisInfo.if_UserNo; qDebug()<<"Enroll person "<<irisInfo.personId; emit enrollPerson(irisInfo); break; case 0x04://delete in>>irisInfo.personId; qDebug()<<"CC-FF-04"; emit deletePerson(irisInfo.personId); break; default: break; } } if(QString::number(sockInfo.commandHead,16)=="ccaa") //answer { switch(sockInfo.command) { case 0x01: qint32 nums; in>>nums; emit deleteRecord(nums); break; default: break; } } }QT_CATCH(...){ } in.device()->close(); }