コード例 #1
0
ファイル: TimeService.cpp プロジェクト: tdfischer/glovebox
TimeService::TimeService()
  : Service()
{
  setName("time");
  m_timer = new QTimer(this);
  connect(m_timer, SIGNAL(timeout()), this, SLOT(timeUpdate()));
}
コード例 #2
0
ファイル: filetransfer.cpp プロジェクト: partition/kadu
fileTransferThread::fileTransferThread(QString f,int i,QString h,quint16 p,bool receiveMode,QObject *parent): QThread(parent) {
	port=p;
	host=h;
	owner=f;
	rndid=i;
	current = new QFile(this);

	if(receiveMode) {
		socket = new QTcpSocket(this);
		connect( socket, SIGNAL( readyRead() ), this, SLOT( readyRead() ) );
		connect( socket, SIGNAL( error(QAbstractSocket::SocketError) ), this, SLOT( error(QAbstractSocket::SocketError) ) );
		connect( socket, SIGNAL( disconnected() ), this, SLOT( disconnected() ) );
		connect( socket, SIGNAL( connected() ), this, SLOT( estabilishFileReceiving() ) );
		socket->connectToHost(h,p);
		server = 0;
	} else {
		server = new QTcpServer(this);
		connect( server, SIGNAL( newConnection() ), this, SLOT( newConnection() ) );
		connect( this, SIGNAL( readyToFileSend( const QByteArray& ) ), this, SLOT( sendFileChunk( const QByteArray& ) ) );
	}

	t=new QTimer(this);
	connect(t, SIGNAL( timeout() ), this, SLOT( timeUpdate() ) );

	currentFile=1;
	allSize=0;
	allTime=0;
	fc=0;
}
コード例 #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->label->setAttribute(Qt::WA_TranslucentBackground);
    ui->label_2->setAttribute(Qt::WA_TranslucentBackground);
    ui->label_3->setAttribute(Qt::WA_TranslucentBackground);
    ui->label_4->setAttribute(Qt::WA_TranslucentBackground);
    ui->label_5->setAttribute(Qt::WA_TranslucentBackground);
    ui->window->setEditTriggers(QAbstractItemView::NoEditTriggers);
    ui->label_6->setAttribute(Qt::WA_TranslucentBackground);
    ui->window->setColumnWidth(0,90);
    ui->window->setColumnWidth(1,90);
    ui->window->setColumnWidth(2,85);
    ui->window->setColumnWidth(3,85);
    ui->window->setColumnWidth(4,85);
    ui->window->setColumnWidth(5,85);
    ui->window->setColumnWidth(6,85);
    ui->window->setColumnWidth(7,86);
    for(int i=0;i<8;i++)
    {
        ui->window->setRowHeight(i,40);
    }
    vipinform1=new vipinform;
    configw1=new configw;
    configw1->setWindowTitle(QString::fromLocal8Bit("配置"));
    configw1->exec();
    timeUpdate();
}
コード例 #4
0
ファイル: flywheel.c プロジェクト: ErnWong/NothingButNet
void update(Flywheel *flywheel)
{
	float timeChange = timeUpdate(&flywheel->microTime);
	measureRpm(flywheel, timeChange);
	controllerUpdate(flywheel, timeChange);
	updateMotor(flywheel);
	// TODO: update smart motor group.
}
コード例 #5
0
void SignalHelper::fireSignal(quint32 ntime, quint32 nallowedTime, quint32 nroomclock, QString nstageName){
    if (time != ntime){
        time = ntime;
        emit timeUpdate(time);
        emit timeUpdate(this->toString());
    }
    if (allowedTime != nallowedTime){
        allowedTime = nallowedTime;
        emit allowedTimeChanged(allowedTime);
    }
    if (roomclock != nroomclock){
        roomclock = nroomclock;
        emit roomClockChanged(roomclock > 0);
    }
    if (nstageName != stageName){
        stageName = nstageName;
        emit stageNameChanged(stageName);
    }
}
コード例 #6
0
ファイル: Animation.cpp プロジェクト: jonatanolofsson/syrup
 void Animation::run()
 {
     init();
     //~ while(started < 2) taskYIELD();
     for (;;)
     {
         timeUpdate();
         display->clear();
         drawFrame();
         display->flush();
     }
 }
コード例 #7
0
ファイル: ch9example6.c プロジェクト: orcasabitha/Sabitha
int main(void)
{
	struct time timeUpdate(struct time now);
	struct time testTimes[5] = { { 11, 59, 59 }, { 12, 0, 0 }, { 1, 29, 59 }, { 23, 59, 59 }, { 19, 12, 27 }};
	int i;

	for( i = 0; i < 5; ++i ) {
	printf("Time is %.2i:%.2i:%.2i", testTimes[i].hour, testTimes[i].minutes, testTimes[i].seconds);
	testTimes[i] = timeUpdate(testTimes[i]);
	printf(" ...one second later it's %.2i:%.2i:%.2i\n", testTimes[i].hour, testTimes[i].minutes, testTimes[i].seconds);
	}

	return 0;
}
コード例 #8
0
ファイル: utils.c プロジェクト: CoREse/PBWTLib
void die (char *format, ...)
{
  va_list args ;

  va_start (args, format) ;
  fprintf (stderr, "FATAL ERROR: ") ;
  vfprintf (stderr, format, args) ;
  fprintf (stderr, "\n") ;
  va_end (args) ;

  timeUpdate (stderr) ;

  exit (-1) ;
}
コード例 #9
0
ファイル: 8.5.c プロジェクト: ceye1992/learn
int main(void)
{
    struct time timeUpdate(struct time now);
    struct time currentTime, nextTime;

    printf("Enter the time(hh:mm:ss): ");
    scanf("%i:%i:%i", &currentTime.hour, &currentTime.minutes, &currentTime.seconds );

    nextTime = timeUpdate(currentTime);

    printf("Updated time is %.2i:%.2i:%.2i\n", nextTime.hour, nextTime.minutes, nextTime.seconds);

    return 0;
}
コード例 #10
0
struct dateAndTime clockKeeper(struct dateAndTime dt)
{	//
	// Function to update TIME, and DATE if time is 23:59:59
	//

	struct date dateUpdate(struct date today);
	struct time timeUpdate(struct time now);

	dt.stime = timeUpdate(dt.stime);

	if (dt.stime.hour == 0 && dt.stime.minutes == 0 && dt.stime.seconds == 0)
		dt.sdate = dateUpdate(dt.sdate);

	return dt;
}
コード例 #11
0
void RotationOnlyKF::addVelocityMeasurement( const Measurement::RotationVelocity& m )
{
	// time update: forward filter to requested timestamp
	timeUpdate( m.time() );
	
	// create measurement as ErrorVector
	Math::ErrorVector< double, 3 > v;
	v.value = *m;
	v.covariance = Math::Matrix< double, 3, 3 >::identity() * 0.00001; // magic number, tune here
	
	// measurement update:
	kalmanMeasurementUpdateIdentity< 7, 3 >( m_state, v, 4, 7 );

	// normalize quaternion
	Math::transformRangeInternalWithCovariance< 7 >( Math::Function::VectorNormalize( 4 ), m_state, 0, 4, 0, 4 );
}
コード例 #12
0
void RotationOnlyKF::addRotationMeasurement( const Measurement::Rotation& m )
{
	// on first update, set quaternion
	if ( m_time == 0 )
		m->toVector( m_state.value );
		
	// time update: forward filter to requested timestamp
	timeUpdate( m.time() );
	
	// create measurement as ErrorVector
	Math::ErrorVector< double, 4 > v;
	m->negateIfCloser( Math::Quaternion::fromVector( m_state.value ) ).toVector( v.value );
	v.covariance = Math::Matrix< double, 4, 4 >::identity() * 0.004; // magic number, tune here
	
	// measurement update:
	kalmanMeasurementUpdateIdentity< 7, 4 >( m_state, v, 0, 4 );

	// normalize quaternion
	Math::transformRangeInternalWithCovariance< 7 >( Math::Function::VectorNormalize( 4 ), m_state, 0, 4, 0, 4 );
}
コード例 #13
0
ファイル: prog9.6.c プロジェクト: kinogen/c
int main (void)
{
    struct time timeUpdate (struct time n);
    struct time testTimes[6] =
        { { 11, 59, 59 }, { 12,  0,  0 }, {  1, 29, 59 },
          { 23, 59, 59 }, { 19, 12, 27 }, { 24, 60, 60 } };
    int i;

    for ( i = 0; i < 6; ++i )
    {
        printf ("Time is %.2i:%.2i:%.2i\n", testTimes[i].hour,
                  testTimes[i].minutes, testTimes[i].seconds);

        testTimes[i] = timeUpdate (testTimes[i]);

        printf ("One seconds later, it is %.2i:%.2i:%.2i\n\n", testTimes[i].hour,
                                    testTimes[i].minutes, testTimes[i].seconds);
    }

    return 0;
}
コード例 #14
0
ファイル: mdk_D3D11.cpp プロジェクト: ming4883/MingDx11Test
void D3D11Demo::paint (Graphics&)
{
    if (renderThreadExists())
        return;

    renderThreadStart ([this] (Thread* thread)
    {
        {
            ErrorReporter r (this);
            if (!d3d11.startup (getTopLevelComponent()->getWindowHandle()))
                return;
        }

        {
            ErrorReporter r (this);
            if (!demoStartup())
                return;
        }

        timeInit();

        while (!thread->threadShouldExit())
        {
            ErrorReporter r (this);
            timeUpdate();
            demoUpdate();
            Thread::yield();
        }

        {
            ErrorReporter r (this);
            demoShutdown();
        }

        {
            ErrorReporter r (this);
            d3d11.shutdown();
        }
    });
}
コード例 #15
0
void pbwtShapeItWithMiss (PBWT *p, FILE *out) {
 
  if (!p || !p->yz) die ("option -longWithin called without a PBWT") ;
  
  /********   ref  *****/
  uchar **reference = pbwtHaplotypes (p) ; /* haplotypes for reference  (M * N)  */

  /*********************/

  uchar *x;                 /* use for current query */
  PbwtCursor *up = pbwtCursorCreate (p, TRUE, TRUE) ;
  int **u ;   /* stored indexes */
  int i, j, k, N = p->N, M = p->M ;
  int num_1;      /* for the num of heterozyogous */
  int s, seg_num; /* for the segment number and current segment */
  
  /* build indexes */
  u = myalloc (N,int*) ; for (i = 0 ; i < N ; ++i) u[i] = myalloc (p->M+1, int) ;
  x = myalloc (N, uchar) ; 
  int *cc = myalloc (p->N, int) ;

  /* make pbwt index */
  for (k = 0 ; k < N ; ++k)
    { 
      cc[k] = up->c ;
      pbwtCursorCalculateU (up) ;
      memcpy (u[k], up->u, (M+1)*sizeof(int)) ;
      pbwtCursorForwardsReadAD (up, k) ;
    }
  int time = 150;
  int **geno;
  geno = myalloc(time, int*);
  for (i = 0; i < time; ++i) geno[i] = myalloc (p->N, int);
  
  for (j = 0; j < time; ++j) {
     for (i = 0; i < p->N; ++i) {
        geno[j][i] = reference[j * 2][i] + reference[j * 2 + 1][i];
     }
  }

  //clean up
  pbwtCursorDestroy (up) ;
  for (j = 0 ; j < M ; ++j) free(reference[j]) ; free (reference) ;

  fprintf (stderr, "Made indices: \n") ; timeUpdate ();

  int *pos;           /* record the heterozyogous position */
  pos = myalloc (N, int) ;
for (int t = 0; t < time; ++t) {
  
  num_1 = 0;      /* for the num of heterozyogous */
  s = 0;
  seg_num = 1; /* for the segment number and current segment */
  
  /* find the heterozyogous position and record */
  for ( i = 0, j = 0; i < N; ++i) {
    if (geno[t][i] == 1) {
      ++j;
      pos[num_1++] = i;
      if (j == 3) {
        ++seg_num;
        j = 0;
      }
    }
  }

  int start, depth;
  int *het = myalloc(6, int);


fprintf (stderr, "seg_num  %d \n", seg_num);
  for (s = 0; s < seg_num - 2; ++s) {
      Tables *tables = 0;
      uchar *seq;
      if (!s)
	start = 0;
      else
	start = pos[s * 3 - 1] + 1;
      
      for (i = 0; i < 6; ++i) {
        het[i] = pos[s * 3 + i];
      }

      depth = het[5] - start + 1;
      seq = myalloc(depth + 1, uchar);
      memset(seq, '2', depth * sizeof(uchar));
      seq[depth] = '\0';
      tables = tablesCreate(500);
      extendMatch(het, start, 0, depth, seq, cc, u, 0, M, &tables);
//fprintf (stderr, "display  s = %d,  depth = %d \t table size = %d\n", s, depth, tables->num);
//tablesDisplay(tables);      
      free(seq);
      tablesDestroy(tables);
  }
  free(het);
}
  fprintf (stderr, "finished \n") ; timeUpdate ();
  /* cleanup */
  free(x); free(pos); free(cc);
  for (j = 0 ; j < N ; ++j) free(u[j]) ; free (u) ;
  for (j = 0 ; j < time; ++j) free(geno[j]) ; free (geno);
}
コード例 #16
0
ファイル: TimeService.cpp プロジェクト: tdfischer/glovebox
void
TimeService::requestUpdate(const QString &key)
{
  timeUpdate();
}
コード例 #17
0
ファイル: eq_clock.c プロジェクト: ggaavv/Equinox-Clock
void setup() {


	// TODO: Move to INIT!!!!



	//setup shiftpwm pins
	pinMode(ShiftPWM_dataPin, OUTPUT);
	digitalWrite(ShiftPWM_dataPin, HIGH);
	pinMode(ShiftPWM_clockPin, OUTPUT);
	digitalWrite(ShiftPWM_clockPin, HIGH);
	pinMode(ShiftPWM_latchPin, OUTPUT);
	digitalWrite(ShiftPWM_latchPin, HIGH);

	//Pin test
	while(0){
		digitalWrite(txPin, HIGH);
		digitalWrite(txPin, LOW);
	}
	//Pin test
	while(0){
		char a=20;
//		for(char a=0; a<31; a++){
//			Serial.println(a, DEC);
			pinMode(a, OUTPUT);
//			for(char b=0; a<255; a++){
				digitalWrite(a, HIGH);
				digitalWrite(a, LOW);
//				delay(500);
//			}
//		}
	}
	//Pin test
	while(0){
		digitalWrite(ShiftPWM_dataPin, HIGH);
		digitalWrite(ShiftPWM_dataPin, LOW);
	}

/*
	Serial.begin(4800);
	Serial.println("Start H uart");

	Serial.println();
	Serial.println();
	Serial.println();
	Serial.println();
	for(unsigned char a=0,b; a<25; a++){
		DDRA=0xff;
		DDRB=0xff;
		DDRC=0xff;
		DDRD=0xff;
		PORTA=0xff;
		PORTB=0xff;
		PORTC=0xff;
		PORTD=0xff;
		digitalWrite(a, LOW);
		Serial.print("digitalWrite(");Serial.print(a,DEC);Serial.println(", LOW)");
		Serial.print("PORTA=");Serial.println(PORTA,BIN);
		Serial.print("PORTB=");Serial.println(PORTB,BIN);
		Serial.print("PORTC=");Serial.println(PORTC,BIN);
		Serial.print("PORTD=");Serial.println(PORTD,BIN);
		digitalWrite(a, HIGH);
//		Serial.print("digitalWrite(");Serial.print(a,DEC);Serial.println(", HIGH)");
//		Serial.print("PORTA=");Serial.println(PORTA,BIN);
//		Serial.print("PORTB=");Serial.println(PORTB,BIN);
//		Serial.print("PORTC=");Serial.println(PORTC,BIN);
//		Serial.print("PORTD=");Serial.println(PORTD,BIN);
	}
*/
	//PWM Pin test
	while(0){
		for(unsigned char a=0,b; a<3; a++){
			b=(1<<a);
			unsigned char b=0xAA;
			//Send the LED output to the shift register
//			mySerial.println(b,BIN);
			digitalWrite(ShiftPWM_latchPin,LOW);
			shiftOut(ShiftPWM_dataPin,ShiftPWM_clockPin,LSBFIRST,b);    //High byte first
			shiftOut(ShiftPWM_dataPin,ShiftPWM_clockPin,LSBFIRST,b);           //Low byte second
			digitalWrite(ShiftPWM_latchPin,HIGH);
			delay(200);
		}
	}

	//Setup USART for MSPIM
	UBRR0L = 0; //Reset for MSPI to work
	UBRR0H = 0; //Reset for MSPI to work
	//Do not modify for fastest MSPIM

	//Disable UART receiver with no interrupts
	UCSR0B = ((0<<TXEN0)|(0<<RXEN0)|(0<<UDRIE0)|(0<<TXCIE0)|(0<<RXCIE0));
//	mySerial.print("Off UCSR0B=");
//	mySerial.println(UCSR0B,BIN);
	//Set Master SPI Mode
	UCSR0C = (
			(0<<UCPOL0)|	//Bit 0 - UCPOLn: Clock polarity
			(0<<UCPHA0)|	//Bit 1 - UCPHAn: Clock phase
			(1<<UDORD0)|	//Bit 2 - UDORDn: Data order (LSB First=1)
							//Bit 5:3 - Reserved bits in MSPI mode3
			(1<<UMSEL00)|	//Bit 7:6 - UMSELn1:0: USART mode select (MSPI=11)
			(1<<UMSEL01));
//	mySerial.print("SPI UCSR0C=");
//	mySerial.println(UCSR0C,BIN);

//	mySerial.println(UBRR0H,BIN);
//	mySerial.println(UBRR0L,BIN);

	//Enable UART receiver with no interrupts
	UCSR0B = ((1<<TXEN0)	//Bit 3 – TXENn: Transmitter Enable n
			|(0<<RXEN0)		//Bit 4 – RXENn: Receiver Enable n
			|(0<<UDRIE0)	//Bit 5 – UDRIEn: USART Data Register Empty Interrupt Enable n
			|(0<<TXCIE0)	//Bit 6 – TXCIEn: TX Complete Interrupt Enable n
			|(0<<RXCIE0));	//Bit 7 – RXCIEn: RX Complete Interrupt Enable n
//	mySerial.print("On UCSR0B=");
//	mySerial.println(UCSR0B,BIN);

//#define MSPIBAUD 8000000
//#define MSPIBAUD 230400
//#define MSPIBAUD 115200
//#define MSPIBAUD 9600
//#define MSPIUBRR F_CPU/16/MSPIBAUD-1
//	UBRR0H = (unsigned char)(MSPIUBRR>>8);
//	UBRR0L = (unsigned char)MSPIUBRR;
//	UBRR0L = 0x00;
//	UBRR0L = 0x00;

	ShiftPWM.SetAmountOfRegisters(numRegisters);
	ShiftPWM.Start(pwmFrequency,maxBrightness);
//	ShiftPWM.PrintInterruptLoad();
//	while(0);//Lock up
//	sei();


	while(0){
//		mySerial.println("255");
//		delay(2500);
//		ShiftPWM.SetAll(50);
//		mySerial.println("0");
//		delay(500);
//		mySerial.println("PWM");
		ShiftPWM.OneByOneSlow();
//		ShiftPWM.SetOne(8,255);delay(1000);ShiftPWM.SetAll(0);
//		ShiftPWM.SetOne(1,255);delay(200);ShiftPWM.SetAll(0);
//		ShiftPWM.SetAll(255);
	}
	while(0)
		rgbLedRainbow(ShiftPWM.m_amountOfOutputs, 5, 3, maxBrightness, ShiftPWM.m_amountOfOutputs,true);

	while(0) {
		for(char a=0; a<9; a++){
//			mySerial.print(a,DEC);
			ShiftPWM.SetAll(0);
			ShiftPWM.SetOne(a,255);
			for(char a=0; a<9; a++) {
//				mySerial.print("	");
//				mySerial.print(ShiftPWM.m_PWMValues[a],HEX);
			}
//			mySerial.println();
			delay(1000);
		}
	}

//	mySerial.println("PWMUSART");
	while(0){
		for(char a=9,b; a>0; a--){
			b=(1<<a);
//			mySerial.println("UDR0");
//			mySerial.println(b,BIN);
			for(int a=0; a<0xfff; a++){
				digitalWrite(ShiftPWM_latchPin,LOW);
				for(int a=0; a<2; a++){
	//				UDR0 = 0x01; // Send the byte to the USART_MSPI
					UDR0 = b; // Send the byte to the USART_MSPI
					//vvvv Wait for TX sent vvvv
					while (!(UCSR0A & _BV(TXC0)));    // wait for last send to finish and retreive answer. Retreive must be done, otherwise the USART_MSPI will not work.
					UCSR0A |= _BV(TXC0);//sbi
					//^^^^ Wait for TX sent ^^^^
				}
				digitalWrite(ShiftPWM_latchPin,HIGH);
			}
			delay(500);
		}
	}
//	cli(); //Disable interrupts


//	Serial.begin(4800);
//	Serial.println("Start H uart");
//	delay(1000);


//	PROGMEMprint(stringDOTKLOK);
//	Serial.println(REV);
//	delay(1000);
#ifdef USE_ANSI
	ANSI.eraseScreen();
	ANSI.home();
#endif

//	if(DEBUG){
//		Serial.println("DEBUG true, serial port open at 57600");
//		Serial.print("Avail mem = ");
//		Serial.println(availableMemory());
//	}
//	else{
//		Serial.print("DK "); Serial.println(REV);
//		Serial.println("DEBUG false, serial port closed");
//		Serial.end();
//	}

  // general set up
  pinMode(13, OUTPUT);

  // RTC setup
  Wire.begin();
//  RTC.begin();
  DST.begin();
//	DateTime set = DateTime(__DATE__, __TIME__);
//	DateTime set = DateTime(2011,10,30,00,59,48);
//	set.toString();
//	RTC.adjust(DateTime(__DATE__, __TIME__));
//  RTC.adjust(DateTime(2011,10,30,00,59,48));
//  delay(1000);
  if (!RTC.isrunning()) {
//    if(DEBUG) PROGMEMprint(stringRTC_NOT_running);
    // following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }
///  else {
//    if(DEBUG) PROGMEMprint(stringRTC_running);
///  }
  	//Update time variables

//	cli();mySerial.println("u");sei();
	if(1){
		timeUpdate();
		timeUpdate();
		//Sets sunrise/sunset time for dimming
		dailyCheck();
		dailyCheck();
		//Sets screen brightness
		minutelyCheck();
		minutelyCheck();
		//Checks and adjusts time for DST
		hourlyCheck();
		hourlyCheck();
	}
//////////////goodgood	rgbLedRainbow(ShiftPWM.m_amountOfOutputs, 1, 1, maxBrightness, ShiftPWM.m_amountOfOutputs,true);
//cli();mySerial.println("loop begin");//sei();



} // end setup()
コード例 #18
0
ファイル: mainwindow.cpp プロジェクト: drogenlied/QIYPTClock
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    unsigned int sig = 123456;
    unsigned int port = 54545;
    std::string addressString = "255.255.255.255";
    bool noconfig = false;

    try {
        TCLAP::CmdLine cmd("iyptclock", ' ', "0.9");
        TCLAP::ValueArg<unsigned int> portArg("p", "port","Port to listen on", false, 54545, "unsigned integer");
        TCLAP::ValueArg<unsigned int> sigArg("s", "signature","Signature to use", false, 123456 , "unsigned integer");
        TCLAP::ValueArg<std::string> bcastArg("b", "broadcast","Broadcast address to send packets to", false, "255.255.255.255", "ip address");
        TCLAP::SwitchArg noconfigArg("n", "noconfig", "disable configuration", false);

        cmd.add( portArg );
        cmd.add( sigArg );
        cmd.add( bcastArg );
        cmd.add( noconfigArg );
        cmd.parse( QApplication::argc(), QApplication::argv() );

        port = portArg.getValue();
        sig = sigArg.getValue();
        addressString = bcastArg.getValue();
        noconfig = noconfigArg.getValue();

    } catch (TCLAP::ArgException &e) {
        std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl;
    }

    ui->setupUi(this);

    connect(ui->idButton, SIGNAL(clicked()), this, SLOT(triggerId()));
    connect(ui->portButton, SIGNAL(clicked()), this, SLOT(triggerPort()));
    connect(ui->startstop, SIGNAL(clicked()), this, SLOT(toggleStartPause()));
    connect(ui->delButton, SIGNAL(clicked()), this, SLOT(triggerDel()));
    connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveStages()));

    ad = new AboutDialog();

    connect(ui->actionAbout_IYPTClock, SIGNAL(triggered()), ad, SLOT(exec()));

    timer = new QTimer();
    connect(timer, SIGNAL(timeout()), ui->graphicsView, SLOT(act()));
    timer->start(30);

    thc = new ThemeClock();

    connect(thc, SIGNAL(timeUpdate(int)), ui->graphicsView, SLOT(setTime(int)));
    connect(thc, SIGNAL(timeUpdate(int)), this, SLOT(setLcdWidthForTime(int)));
    connect(thc, SIGNAL(allowedTimeChanged(int)), ui->graphicsView, SLOT(setAllowedTime(int)));
    connect(thc, SIGNAL(started(int)), ui->graphicsView, SLOT(setTime(int)));
    connect(thc, SIGNAL(paused(int)), ui->graphicsView, SLOT(setTime(int)));
    connect(thc, SIGNAL(restarted(int)), ui->graphicsView, SLOT(setTime(int)));
    connect(thc, SIGNAL(stopped(int)), ui->graphicsView, SLOT(setTime(int)));
    connect(ui->startstop, SIGNAL(clicked()), thc, SLOT(startorpause()));
    connect(ui->resetButton, SIGNAL(clicked()), thc, SLOT(reset()));
    connect(ui->setTimeButton, SIGNAL(clicked()), this, SLOT(setTime()));
    ui->setTimeComboBox->addItem(tr("last saved time"), QVariant(TIME_SAVED));
    ui->setTimeComboBox->addItem(tr("elapsed time"), QVariant(TIME_ELAPSED));
    ui->setTimeComboBox->addItem(tr("remaining time"), QVariant(TIME_LEFT));

    connect(thc, SIGNAL(timeUpdate(QString)), ui->lcdNumber, SLOT(display(QString)));

    lc = new ListController();

    connect(ui->ffwd, SIGNAL(clicked()), lc, SLOT(forward()));
    connect(ui->bwd, SIGNAL(clicked()), lc, SLOT(backward()));
    connect(ui->addButton, SIGNAL(clicked()), lc, SLOT(add()));
    connect(thc, SIGNAL(started(int)), lc, SLOT(checkAutoStart()));
    connect(this, SIGNAL(itemShouldBeDeleted(QModelIndex)), lc, SLOT(del(QModelIndex)));
    connect(lc, SIGNAL(allowedTimeChanged(int)), thc, SLOT(setAllowedTime(int)));
    connect(lc, SIGNAL(roomClockChanged(bool)), ui->graphicsView, SLOT(setRoomclock(bool)));
    connect(lc, SIGNAL(resetTime()), thc, SLOT(reset()));
    connect(lc, SIGNAL(endOfStage()), thc, SLOT(stop()));
    connect(lc, SIGNAL(stageNameChanged(QString)), ui->stageLabel, SLOT(setText(QString)));
    connect(lc, SIGNAL(modelChanged(QAbstractTableModel*)), this, SLOT(propagateModel(QAbstractTableModel*)));

    ui->portBox->setValue(port);
    ui->idBox->setValue(sig);

    bs = new BroadcastServer(this, QHostAddress(addressString.c_str()), port, sig);

    connect(thc, SIGNAL(timeUpdate(int)), bs, SLOT(updateTime(int)));
    connect(thc, SIGNAL(restarted(int)), bs, SLOT(updateTime(int)));
    connect(thc, SIGNAL(stopped(int)), bs, SLOT(updateTime(int)));
    connect(thc, SIGNAL(allowedTimeChanged(int)), bs, SLOT(setAllowedTime(int)));
    connect(lc, SIGNAL(roomClockChanged(bool)), bs, SLOT(setRoomclock(bool)));
    connect(lc, SIGNAL(stageNameChanged(QString)), bs, SLOT(setStageName(QString)));
    connect(this, SIGNAL(newPort(uint)), bs, SLOT(setBroadcastPort(uint)));
    connect(this, SIGNAL(newID(uint)), bs, SLOT(setSignature(uint)));

    connect(lc, SIGNAL(overTimeChanged(int)), thc, SLOT(setOverTime(int)));
    connect(thc, SIGNAL(overtimed(int)), lc, SLOT(handleOvertime(int)));
    connect(lc, SIGNAL(elapsedTimeChanged(int)), thc, SLOT(setElapsedTime(int)));
    connect(lc, SIGNAL(elapsedTimeChanged(int)), ui->graphicsView, SLOT(setTime(int)));
    connect(lc, SIGNAL(elapsedTimeChanged(int)), bs, SLOT(updateTime(int)));
    connect(lc, SIGNAL(getElapsedOverTime()), thc, SLOT(getElapsedOverTime()));
    connect(thc, SIGNAL(elapsedOverTime(int)), lc, SLOT(setElapsedOverTime(int)));

    if (noconfig)
      {
        ui->tabWidget->setTabEnabled(1,false);
      }

    if (QFile("stages.txt").exists()){
        lc->loadListFromFile("stages.txt");
    } else if (QFile("/usr/share/iyptclock/stages.txt").exists()){
        lc->loadListFromFile("/usr/share/iyptclock/stages.txt");
    } else {
        lc->loadListFromFile("");
    }
    thc->stop();

    timer2 = new QTimer();
    connect(timer2, SIGNAL(timeout()), this, SLOT(toggleStartPause()));
    connect(timer2, SIGNAL(timeout()), this, SLOT(toggleTimeSpinBox()));
    timer2->start(100);

    savefile = QString("/var/run/iyptclock/autosave_");
    savefile += QString::number(sig);

    as = new AutoSave(this,savefile,this);
    as->load();

    timer3 = new QTimer();
    connect(timer3, SIGNAL(timeout()),as,SLOT(save()));
    timer3->start(1000);
}