RuskWindow* makeRusk() { RuskWindow *rusk; if((rusk = malloc(sizeof(RuskWindow))) == NULL) { return NULL; } if(makeWindow(rusk) != 0) { return NULL; } if(setupWebView(rusk) != 0) { return NULL; } if(connectDataBase(rusk) != 0) { return NULL; } g_ruskCounter++; return rusk; }
MainWindow::MainWindow( QString myname ) : QMainWindow() { setupUi( this ); MainTab->setCurrentIndex( 0 ); RWDXMCenterF = false; DXMCenterFile = DXMCENTERFILE0; MCACanSaveAllOnMem = false; MCAPreAMPGainHasSet = false; MaxMCAEnergy = 20; MStabOk = false; MStabDelegate = ""; #if 0 AutoShutter->setChecked( false ); // 自動シャッターのボタンはデフォルトでは AutoShutter->setEnabled( false ); // 使えなくしておく #endif MCAFSel = scanFSel = monFSel = S2DFileSel = SelDFND = SelWBFND = SelRBFND = SelLFND = NULL; // Monitor の中で SSD の強度を別ファイルに書き出すときの時間を測るため T = new QTime; T->start(); FSTATMsgs[0][0] = tr( "Both the name and the data is old." ); FSTATMsgs[0][1] = tr( "The name is new, but the data is old." ); FSTATMsgs[1][0] = tr( "The data is new, but the name is old." ); FSTATMsgs[1][1] = tr( "The data and the name is new, but not saved." ); MeasDataStat = MeasNameStat = OLD; ScanDataStat = ScanNameStat = OLD; MonDataStat = MonNameStat = OLD; MCADataStat = MCANameStat = OLD; S2DDataStat = S2DNameStat = OLD; isQXafsModeAvailable = false; XMAPk2p = new KeV2Pix; fdbase = new FluoDBase; u = new Units; MMainTh = NULL; MDTh1 = NULL; EncMainTh = NULL; Enc2 = NULL; SLS = NULL; SI0 = NULL; SI1 = NULL; SFluo = NULL; MMStab = NULL; oldDeg = -100; AllInited = MotorsInited = SensorsInited = false; EncOrPM = XENC; MCAGains.clear(); MeasA = 0; OldDTh1 = 0; StatDisp = new Status(); StatTab->layout()->addWidget( StatDisp ); XAFSName = myname; XAFSKey = myname; XAFSTitle = myname; starsSV = new StarsSV2; conds = new Conditions; conds->setVersionInfo( VERSION, __DATE__, __TIME__ ); alarms = new Alarms; connect( alarms, SIGNAL( alarmOn() ), this, SLOT( alarmOn() ), Qt::UniqueConnection ); connect( alarms, SIGNAL( alarmOff() ), this, SLOT( alarmOff() ), Qt::UniqueConnection ); setupLogArea(); // ログに対する書き出しがある可能性があるので最初にイニシャライズ ReadDef( DefFileName ); remote = new AUnitRemote; connect( remote, SIGNAL( setMeasBlockF( bool ) ), MeasBlockB, SLOT( setChecked( bool ) ), Qt:: UniqueConnection ); selmc = new SelMC2( mccd ); setWindowTitle( XAFSTitle ); s = new Stars; // モータ類のイニシャライズの前に Stars の準備はしておく s->ReadStarsKeys( XAFSKey, XAFSName ); // Stars とのコネクション確立の準備 s->SetNewSVAddress( starsSV->SSVAddress() ); s->SetNewSVPort( starsSV->SSVPort() ); connect( s, SIGNAL( EvAll( SMsg ) ), this, SLOT( RcvEvAll( SMsg ) ), Qt::UniqueConnection ); TTable = new TuningTable; pmConds = new PMConditions; Initialize(); setupView(); setupCommonArea(); setupSetupArea(); // AUnit 関係の Initialize 後でないとだめ if ( SFluo != NULL ) { setupSetupSSDArea(); } else { MainTab->removeTab( MainTab->indexOf( SSDTab ) ); } setupChangerArea(); setupQXafsMode(); setupMeasArea(); setupReadDataArea(); setupScan2DArea(); setupWebView(); setupAutoSequence(); // useFixedDelta = false; connect( conds, SIGNAL( SetDXMPMC() ), this, SLOT( SetDXMPMC() ), Qt::UniqueConnection ); StatDisp->setupStatArea( &AMotors, &ASensors, starsSV, selmc, conds, pmConds ); connect( StatDisp, SIGNAL( NeedListNodes() ), this, SLOT( SendListNodes() ), Qt::UniqueConnection ); // QString msg = "XafsMsg_" + QLocale::system().name(); // NewLogMsg( msg ); NewLogMsg( QString( tr( "Mono: %1 (%2 A)" ) ) .arg( mccd[ selmc->MC() ]->getMCName() ) .arg( mccd[ selmc->MC() ]->getD() ) ); connect( s, SIGNAL( AskShowStat( QString, int ) ), this, SLOT( ShowMessageOnSBar( QString, int ) ), Qt::UniqueConnection ); connect( action_Quit, SIGNAL( triggered() ), qApp, SLOT( closeAllWindows() ), Qt::UniqueConnection ); // connect( action_SelMC, SIGNAL( triggered() ), selmc, SLOT( show() ), // Qt::UniqueConnection ); connect( selmc, SIGNAL( NewLogMsg( QString ) ), this, SLOT( NewLogMsg( QString ) ), Qt::UniqueConnection ); connect( selmc, SIGNAL( NewLatticeConstant( double ) ), u, SLOT( setD( double ) ), Qt::UniqueConnection ); // connect( action_SetSSV, SIGNAL( triggered() ), starsSV, SLOT( show() ), // Qt::UniqueConnection ); connect( starsSV, SIGNAL( SSVNewAddress( const QString & ) ), s, SLOT( SetNewSVAddress( const QString & ) ), Qt::UniqueConnection ); connect( starsSV, SIGNAL( SSVNewPort( const QString & ) ), s, SLOT( SetNewSVPort( const QString & ) ), Qt::UniqueConnection ); connect( s, SIGNAL( RecordSSVHistoryA( const QString & ) ), starsSV, SLOT( RecordSSVHistoryA( const QString & ) ), Qt::UniqueConnection ); connect( s, SIGNAL( RecordSSVHistoryP( const QString & ) ), starsSV, SLOT( RecordSSVHistoryP( const QString & ) ), Qt::UniqueConnection ); connect( starsSV, SIGNAL( AskReConnect() ), s, SLOT( ReConnect() ), Qt::UniqueConnection ); connect( s, SIGNAL( ReConnected() ), this, SLOT( InitializeUnitsAgain() ), Qt::UniqueConnection ); // connect( starsSV, SIGNAL( accepted() ), s, SLOT( ReConnect() ), // Qt::UniqueConnection ); connect( s, SIGNAL( ConnectionIsReady( void ) ), this, SLOT( Initialize( void ) ), Qt::UniqueConnection ); connect( s, SIGNAL( AnsListNodes( SMsg ) ), this, SLOT( RcvListNodes( SMsg ) ), Qt::UniqueConnection ); connect( s, SIGNAL( EvConnected( SMsg ) ), this, SLOT( SomeDrvIsConnected( SMsg ) ), Qt::UniqueConnection ); connect( s, SIGNAL( EvDisconnected( SMsg ) ), this, SLOT( SomeDrvIsDisconnected( SMsg ) ), Qt::UniqueConnection ); if ( ! isQXafsModeAvailable ) { QXafsMode->setChecked( false ); QXafsMode->setEnabled( false ); } GoTimer = new QTimer; MCATimer = new QTimer; ScanTimer = new QTimer; MonTimer = new QTimer; MeasTimer = new QTimer; MeasDarkTimer = new QTimer; connect( GoTimer, SIGNAL( timeout() ), this, SLOT( MotorMove() ), Qt::UniqueConnection ); connect( MCATimer, SIGNAL( timeout() ), this, SLOT( MCASequence() ), Qt::UniqueConnection ); connect( ScanTimer, SIGNAL( timeout() ), this, SLOT( ScanSequence() ), Qt::UniqueConnection ); connect( MonTimer, SIGNAL( timeout() ), this, SLOT( MonSequence() ), Qt::UniqueConnection ); connect( MeasTimer, SIGNAL( timeout() ), this, SLOT( MeasSequence() ), Qt::UniqueConnection ); connect( MeasDarkTimer, SIGNAL( timeout() ), this, SLOT( MeasDarkSequence() ), Qt::UniqueConnection ); connect( s, SIGNAL( SSisActive( bool ) ), StatDisp, SLOT( SetSSVStat( bool ) ), Qt::UniqueConnection ); connect( AddNewDTh1TPoint, SIGNAL( clicked() ), this, SLOT( AddNewDTh1TunePoint() ), Qt::UniqueConnection ); connect( conds, SIGNAL( AskToSaveDTh1TTable() ), TTable, SLOT( SaveTuneTable() ), Qt::UniqueConnection ); connect( conds, SIGNAL( AskToShowDTh1TTable() ), TTable, SLOT( ShowTuneTable() ), Qt::UniqueConnection ); connect( conds, SIGNAL( NewDiff1( int ) ), this, SIGNAL( NewDiff1( int ) ), Qt::UniqueConnection ); connect( conds, SIGNAL( NewDiff2( int ) ), this, SIGNAL( NewDiff2( int ) ), Qt::UniqueConnection ); connect( Special, SIGNAL( clicked() ), this, SLOT( SpecialMove() ) ); conds->setupDataRoot(); // 他のファイルダイアログが全部 new されていないとダメ ! s->AskStatus(); s->MakeConnection(); }