/** * Constructor called when browser is launched from the application plugin tool bar * @param parent - Pointer the to parent QWidget for modality * @param interface - Pointer to the application interface * @param fl - Window flags */ eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget* parent, QgisInterface* interface, Qt::WindowFlags fl ) : QDialog( parent, fl ) { setupUi( this ); QSettings settings; restoreGeometry( settings.value( "/eVis/browser-geometry" ).toByteArray() ); mCurrentFeatureIndex = 0; mInterface = interface; mDataProvider = nullptr; mVectorLayer = nullptr; mCanvas = nullptr; mIgnoreEvent = false; if ( initBrowser() ) { loadRecord(); show(); } else { close(); } }
/** * Slot called when the tabs in the tabWidget are selected * @param theCurrentTabIndex - The index of the currently selected tab */ void eVisGenericEventBrowserGui::on_displayArea_currentChanged( int theCurrentTabIndex ) { //Force redraw when we switching back to the Display tab if ( 0 == theCurrentTabIndex ) { loadRecord(); } }
/** * openFile() * * Given a file name, this attempts to open it for reading. */ bool CSVParser::openFile(const QString &fName, bool firstRowIsHeader) { if (myFile.isOpen()) myFile.close(); myFile.setName(fName); myFile.open(QIODevice::ReadOnly); myStream = new Q3TextStream(&myFile); if (firstRowIsHeader && myFile.isOpen()) { loadRecord(); myHeader = row(); } return myFile.isOpen(); }
/** * Constructor called when browser is launched from the application plugin tool bar * @param parent - Pointer the to parent QWidget for modality * @param interface - Pointer to the application interface * @param fl - Window flags */ eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget *parent, QgisInterface *interface, Qt::WindowFlags fl ) : QDialog( parent, fl ) { setupUi( this ); connect( buttonboxOptions, &QDialogButtonBox::clicked, this, &eVisGenericEventBrowserGui::buttonboxOptions_clicked ); connect( chkboxApplyPathRulesToDocs, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxApplyPathRulesToDocs_stateChanged ); connect( cboxEventImagePathField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxEventImagePathField_currentIndexChanged ); connect( cboxCompassBearingField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassBearingField_currentIndexChanged ); connect( cboxCompassOffsetField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassOffsetField_currentIndexChanged ); connect( chkboxDisplayCompassBearing, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxDisplayCompassBearing_stateChanged ); connect( chkboxEventImagePathRelative, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxEventImagePathRelative_stateChanged ); connect( chkboxUseOnlyFilename, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxUseOnlyFilename_stateChanged ); connect( displayArea, &QTabWidget::currentChanged, this, &eVisGenericEventBrowserGui::displayArea_currentChanged ); connect( dsboxCompassOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &eVisGenericEventBrowserGui::dsboxCompassOffset_valueChanged ); connect( leBasePath, &QLineEdit::textChanged, this, &eVisGenericEventBrowserGui::leBasePath_textChanged ); connect( pbtnAddFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnAddFileType_clicked ); connect( pbtnDeleteFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnDeleteFileType_clicked ); connect( pbtnNext, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnNext_clicked ); connect( pbtnPrevious, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnPrevious_clicked ); connect( pbtnResetApplyPathRulesToDocs, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetApplyPathRulesToDocs_clicked ); connect( pbtnResetBasePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetBasePathData_clicked ); connect( pbtnResetCompassBearingData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassBearingData_clicked ); connect( pbtnResetCompassOffsetData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassOffsetData_clicked ); connect( pbtnResetEventImagePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetEventImagePathData_clicked ); connect( pbtnResetUseOnlyFilenameData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetUseOnlyFilenameData_clicked ); connect( rbtnManualCompassOffset, &QRadioButton::toggled, this, &eVisGenericEventBrowserGui::rbtnManualCompassOffset_toggled ); connect( tableFileTypeAssociations, &QTableWidget::cellDoubleClicked, this, &eVisGenericEventBrowserGui::tableFileTypeAssociations_cellDoubleClicked ); QSettings settings; restoreGeometry( settings.value( QStringLiteral( "eVis/browser-geometry" ) ).toByteArray() ); mCurrentFeatureIndex = 0; mInterface = interface; mDataProvider = nullptr; mVectorLayer = nullptr; mCanvas = nullptr; mIgnoreEvent = false; if ( initBrowser() ) { loadRecord(); show(); } else { close(); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); //Init isSqlSetted = false; //status tips ui->actionDataBase_Info->setStatusTip(tr("Set Database Info.")); ui->actionLogin->setStatusTip(tr("Get Login Dialog.")); ui->actionExit->setStatusTip(tr("Exit the Window.")); ui->actionLogout->setStatusTip(tr("Logout the account.")); //signals and slots connect(ui->actionDataBase_Info, SIGNAL(triggered()), this, SLOT(getDBInfo())); connect(ui->actionLogin, SIGNAL(triggered()), this, SLOT(login())); connect(ui->actionLogout, SIGNAL(triggered()), this, SLOT(reset())); connect(ui->infoWidget, SIGNAL(loadProfile()), this, SLOT(loadProfile())); connect(ui->infoWidget, SIGNAL(loadScore()), this, SLOT(loadScore())); connect(ui->infoWidget, SIGNAL(loadCurriculumSchedule()), this, SLOT(loadCurriculumSchedule())); connect(ui->infoWidget, SIGNAL(loadElective()), this, SLOT(loadElective())); connect(ui->infoWidget, SIGNAL(loadPlan()), this, SLOT(loadPlan())); connect(ui->infoWidget, SIGNAL(loadRecord()), this, SLOT(loadRecord())); connect(ui->infoWidget, SIGNAL(chgPwd()), this, SLOT(changePwd())); // dbInfo.hostName = "localhost"; // dbInfo.DBName = "Handin"; // dbInfo.userName = "******"; // dbInfo.password = "******"; //login(); }
/** * Slot called when the pbtnNext button is pressed */ void eVisGenericEventBrowserGui::on_pbtnNext_clicked() { if ( mCurrentFeatureIndex != mFeatureIds.size() - 1 ) { pbtnPrevious->setEnabled( true ); mCurrentFeatureIndex++; setWindowTitle( tr( "Event Browser - Displaying records %1 of %2" ) .arg( mCurrentFeatureIndex + 1, 2, 10, QChar( '0' ) ).arg( mFeatureIds.size(), 2, 10, QChar( '0' ) ) ); loadRecord(); } if ( mCurrentFeatureIndex == mFeatureIds.size() - 1 ) { pbtnNext->setEnabled( false ); } }
/** * Constructor called when browser is launched by the eVisEventIdTool * \param parent - Pointer to the parent QWidget for modality * \param canvas - Pointer to the map canvas * \param fl - Window flags */ eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget *parent, QgsMapCanvas *canvas, Qt::WindowFlags fl ) : QDialog( parent, fl ) , mCanvas( canvas ) { setupUi( this ); connect( buttonboxOptions, &QDialogButtonBox::clicked, this, &eVisGenericEventBrowserGui::buttonboxOptions_clicked ); connect( chkboxApplyPathRulesToDocs, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxApplyPathRulesToDocs_stateChanged ); connect( cboxEventImagePathField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxEventImagePathField_currentIndexChanged ); connect( cboxCompassBearingField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassBearingField_currentIndexChanged ); connect( cboxCompassOffsetField, static_cast<void ( QComboBox::* )( int )>( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassOffsetField_currentIndexChanged ); connect( chkboxDisplayCompassBearing, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxDisplayCompassBearing_stateChanged ); connect( chkboxEventImagePathRelative, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxEventImagePathRelative_stateChanged ); connect( chkboxUseOnlyFilename, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxUseOnlyFilename_stateChanged ); connect( displayArea, &QTabWidget::currentChanged, this, &eVisGenericEventBrowserGui::displayArea_currentChanged ); connect( dsboxCompassOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &eVisGenericEventBrowserGui::dsboxCompassOffset_valueChanged ); connect( leBasePath, &QLineEdit::textChanged, this, &eVisGenericEventBrowserGui::leBasePath_textChanged ); connect( pbtnAddFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnAddFileType_clicked ); connect( pbtnDeleteFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnDeleteFileType_clicked ); connect( pbtnNext, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnNext_clicked ); connect( pbtnPrevious, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnPrevious_clicked ); connect( pbtnResetApplyPathRulesToDocs, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetApplyPathRulesToDocs_clicked ); connect( pbtnResetBasePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetBasePathData_clicked ); connect( pbtnResetCompassBearingData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassBearingData_clicked ); connect( pbtnResetCompassOffsetData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassOffsetData_clicked ); connect( pbtnResetEventImagePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetEventImagePathData_clicked ); connect( pbtnResetUseOnlyFilenameData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetUseOnlyFilenameData_clicked ); connect( rbtnManualCompassOffset, &QRadioButton::toggled, this, &eVisGenericEventBrowserGui::rbtnManualCompassOffset_toggled ); connect( tableFileTypeAssociations, &QTableWidget::cellDoubleClicked, this, &eVisGenericEventBrowserGui::tableFileTypeAssociations_cellDoubleClicked ); if ( initBrowser() ) { loadRecord(); show(); } else { close(); } }
/** * Constructor called when browser is launched by the eVisEventIdTool * @param parent - Pointer to the parent QWidget for modality * @param canvas - Pointer to the map canvas * @param fl - Window flags */ eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget* parent, QgsMapCanvas* canvas, Qt::WindowFlags fl ) : QDialog( parent, fl ) { setupUi( this ); mCurrentFeatureIndex = 0; mInterface = nullptr; mDataProvider = nullptr; mVectorLayer = nullptr; mCanvas = canvas; mIgnoreEvent = false; if ( initBrowser() ) { loadRecord(); show(); } else { close(); } }
/** * Constructor called when browser is launched from the application plugin tool bar * @param parent - Pointer the to parent QWidget for modality * @param interface - Pointer the the application interface * @param fl - Window flags */ eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget* parent, QgisInterface* interface, Qt::WFlags fl ) : QDialog( parent, fl ) { setupUi( this ); mCurrentFeatureIndex = 0; mInterface = interface; mDataProvider = 0; mVectorLayer = 0; mCanvas = 0; mIgnoreEvent = false; if ( initBrowser( ) ) { loadRecord( ); show( ); } else { close( ); } }
RIniFile::RIniFile(const string file) :RHistFile(file) { loadRecord(); }
/** * This method is an extension of the constructor. It was implemented so that it could be called by the GUI at anytime. */ void eVisGenericEventBrowserGui::initOptionsTab() { //The base path has to be set first. If not if/when cboxEventImagePathRelative state change slot //will all ways over write the base path with the path to the data source //TODO: Find some better logic to prevent this from happening. leBasePath->setText( mConfiguration.basePath() ); chkboxUseOnlyFilename->setChecked( mConfiguration.isUseOnlyFilenameSet() ); //Set Options tab gui items int myIndex = cboxEventImagePathField->findText( mConfiguration.eventImagePathField(), Qt::MatchExactly ); if ( -1 != myIndex ) { cboxEventImagePathField->setCurrentIndex( myIndex ); } else { cboxEventImagePathField->setCurrentIndex( mDefaultEventImagePathField ); } chkboxEventImagePathRelative->setChecked( mConfiguration.isEventImagePathRelative() ); myIndex = cboxCompassBearingField->findText( mConfiguration.compassBearingField(), Qt::MatchExactly ); if ( -1 != myIndex ) { cboxCompassBearingField->setCurrentIndex( myIndex ); } else { cboxCompassBearingField->setCurrentIndex( mDefaultCompassBearingField ); } chkboxDisplayCompassBearing->setChecked( mConfiguration.isDisplayCompassBearingSet() ); if ( !mConfiguration.isDisplayCompassBearingSet() ) { cboxCompassBearingField->setEnabled( false ); } dsboxCompassOffset->setValue( mConfiguration.compassOffset() ); myIndex = cboxCompassOffsetField->findText( mConfiguration.compassOffsetField(), Qt::MatchExactly ); if ( -1 != myIndex ) { cboxCompassOffsetField->setCurrentIndex( myIndex ); } else { loadRecord(); cboxCompassOffsetField->setCurrentIndex( mDefaultCompassOffsetField ); } if ( mConfiguration.isManualCompassOffsetSet() ) { rbtnManualCompassOffset->setChecked( true ); rbtnAttributeCompassOffset->setChecked( false ); } else if ( !mConfiguration.compassOffsetField().isEmpty() ) { rbtnManualCompassOffset->setChecked( false ); rbtnAttributeCompassOffset->setChecked( true ); } else { rbtnManualCompassOffset->setChecked( false ); rbtnAttributeCompassOffset->setChecked( false ); dsboxCompassOffset->setEnabled( false ); cboxCompassOffsetField->setEnabled( false ); } chkboxApplyPathRulesToDocs->setChecked( mConfiguration.isApplyPathRulesToDocsSet() ); }
static void testSingleThreading(void) { int i; testsingle data[2]; xdrv *drvs[2]; memset(data, 0, sizeof(data)); for(i=0; i<2; i++) { int p; for(p=0; p<NUM_CALLBACK_PRIORITIES; p++) { data[i].wake[p] = epicsEventMustCreate(epicsEventEmpty); data[i].wait[p] = epicsEventMustCreate(epicsEventEmpty); } } testDiag("Test single-threaded I/O Intr scanning"); testdbPrepare(); testdbReadDatabase("dbTestIoc.dbd", NULL, NULL); dbTestIoc_registerRecordDeviceDriver(pdbbase); /* create two scan lists with one record on each of three priorities */ /* group#, member#, priority */ loadRecord(0, 0, "LOW"); loadRecord(1, 0, "LOW"); loadRecord(0, 1, "MEDIUM"); loadRecord(1, 1, "MEDIUM"); loadRecord(0, 2, "HIGH"); loadRecord(1, 2, "HIGH"); drvs[0] = xdrv_add(0, &testcb, &data[0]); drvs[1] = xdrv_add(1, &testcb, &data[1]); scanIoSetComplete(drvs[0]->scan, &testcomp, &data[0]); scanIoSetComplete(drvs[1]->scan, &testcomp, &data[1]); eltc(0); testIocInitOk(); eltc(1); testDiag("Scan first list"); scanIoRequest(drvs[0]->scan); testDiag("Scan second list"); scanIoRequest(drvs[1]->scan); testDiag("Wait for first list to complete"); for(i=0; i<NUM_CALLBACK_PRIORITIES; i++) epicsEventMustWait(data[0].wait[i]); testDiag("Wait one more second"); epicsThreadSleep(1.0); testOk1(data[0].hasprocd[0]==1); testOk1(data[0].hasprocd[1]==1); testOk1(data[0].hasprocd[2]==1); testOk1(data[0].getcomplete[0]==1); testOk1(data[0].getcomplete[1]==1); testOk1(data[0].getcomplete[2]==1); testOk1(data[1].hasprocd[0]==0); testOk1(data[1].hasprocd[1]==0); testOk1(data[1].hasprocd[2]==0); testOk1(data[1].getcomplete[0]==0); testOk1(data[1].getcomplete[1]==0); testOk1(data[1].getcomplete[2]==0); testDiag("Release the first scan and wait for the second"); for(i=0; i<NUM_CALLBACK_PRIORITIES; i++) epicsEventMustTrigger(data[0].wake[i]); for(i=0; i<NUM_CALLBACK_PRIORITIES; i++) epicsEventMustWait(data[1].wait[i]); testOk1(data[0].hasprocd[0]==1); testOk1(data[0].hasprocd[1]==1); testOk1(data[0].hasprocd[2]==1); testOk1(data[0].getcomplete[0]==1); testOk1(data[0].getcomplete[1]==1); testOk1(data[0].getcomplete[2]==1); testOk1(data[1].hasprocd[0]==1); testOk1(data[1].hasprocd[1]==1); testOk1(data[1].hasprocd[2]==1); testOk1(data[1].getcomplete[0]==1); testOk1(data[1].getcomplete[1]==1); testOk1(data[1].getcomplete[2]==1); testDiag("Release the second scan and complete"); for(i=0; i<NUM_CALLBACK_PRIORITIES; i++) epicsEventMustTrigger(data[1].wake[i]); testIocShutdownOk(); testdbCleanup(); xdrv_reset(); for(i=0; i<2; i++) { int p; for(p=0; p<NUM_CALLBACK_PRIORITIES; p++) { epicsEventDestroy(data[i].wake[p]); epicsEventDestroy(data[i].wait[p]); } } }
static void testMultiThreading(void) { int i; int masks[2]; testmulti data[6]; xdrv *drvs[2]; memset(masks, 0, sizeof(masks)); memset(data, 0, sizeof(data)); for(i=0; i<NELEMENTS(data); i++) { data[i].wake = epicsEventMustCreate(epicsEventEmpty); data[i].wait = epicsEventMustCreate(epicsEventEmpty); } testDiag("Test multi-threaded I/O Intr scanning"); testdbPrepare(); testdbReadDatabase("dbTestIoc.dbd", NULL, NULL); dbTestIoc_registerRecordDeviceDriver(pdbbase); /* create two scan lists with one record on each of three priorities */ /* group#, member#, priority */ loadRecord(0, 0, "LOW"); loadRecord(1, 1, "LOW"); loadRecord(0, 2, "MEDIUM"); loadRecord(1, 3, "MEDIUM"); loadRecord(0, 4, "HIGH"); loadRecord(1, 5, "HIGH"); drvs[0] = xdrv_add(0, &testcbmulti, data); drvs[1] = xdrv_add(1, &testcbmulti, data); scanIoSetComplete(drvs[0]->scan, &testcompmulti, &masks[0]); scanIoSetComplete(drvs[1]->scan, &testcompmulti, &masks[1]); /* just enough workers to process all records concurrently */ callbackParallelThreads(2, "LOW"); callbackParallelThreads(2, "MEDIUM"); callbackParallelThreads(2, "HIGH"); eltc(0); testIocInitOk(); eltc(1); testDiag("Scan first list"); testOk1(scanIoRequest(drvs[0]->scan)==0x7); testDiag("Scan second list"); testOk1(scanIoRequest(drvs[1]->scan)==0x7); testDiag("Wait for everything to start"); for(i=0; i<NELEMENTS(data); i++) epicsEventMustWait(data[i].wait); testDiag("Wait one more second"); epicsThreadSleep(1.0); for(i=0; i<NELEMENTS(data); i++) { testOk(data[i].hasprocd==1, "data[%d].hasprocd==1 (%d)", i, data[i].hasprocd); testOk(data[i].getcomplete==0, "data[%d].getcomplete==0 (%d)", i, data[i].getcomplete); } testDiag("Release all and complete"); for(i=0; i<NELEMENTS(data); i++) epicsEventMustTrigger(data[i].wake); testIocShutdownOk(); for(i=0; i<NELEMENTS(data); i++) { testOk(data[i].getcomplete==1, "data[%d].getcomplete==0 (%d)", i, data[i].getcomplete); } testOk1(masks[0]==0x7); testOk1(masks[1]==0x7); testdbCleanup(); xdrv_reset(); for(i=0; i<NELEMENTS(data); i++) { epicsEventDestroy(data[i].wake); epicsEventDestroy(data[i].wait); } }