Exemplo n.º 1
0
SavedSearchProperties::SavedSearchProperties(QWidget *parent) :
    QDialog(parent)
{
    okPressed = false;
    setWindowTitle(tr("Saved Search"));
    setWindowIcon(QIcon(":search.png"));
    setLayout(&grid);

    connect(&name, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput()));
    connect(&query, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput()));

    nameLabel.setText(tr("Name"));
    queryLabel.setText(tr("Query"));
    queryGrid.addWidget(&nameLabel, 1,1);
    queryGrid.addWidget(&name, 1, 2);
    queryGrid.addWidget(&queryLabel, 2,1);
    queryGrid.addWidget(&query, 2, 2);
    queryGrid.setContentsMargins(10, 10,  -10, -10);
    grid.addLayout(&queryGrid,1,1);

    ok.setText(tr("OK"));
    connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed()));
    cancel.setText(tr("Cancel"));
    connect(&cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed()));
    buttonGrid.addWidget(&ok, 1, 1);
    buttonGrid.addWidget(&cancel, 1,2);
    grid.addLayout(&buttonGrid,2,1);
}
Exemplo n.º 2
0
LoginDialog::LoginDialog(QWidget *parent) :
    QDialog(parent)
{
    okPressed = false;
    setWindowTitle(tr("NixNote Login"));
    setWindowIcon(global.getIconResource(":passwordIcon"));
    setLayout(&grid);

    password.setEchoMode(QLineEdit::Password);

    connect(&userid, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput()));
    connect(&password, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput()));

    useridLabel.setText(tr("Userid"));
    passwordLabel.setText(tr("Password"));
    passwordGrid.addWidget(&useridLabel, 1,1);
    passwordGrid.addWidget(&userid, 1, 2);
    passwordGrid.addWidget(&passwordLabel, 2,1);
    passwordGrid.addWidget(&password, 2, 2);
    passwordGrid.setContentsMargins(10, 10,  -10, -10);
    grid.addLayout(&passwordGrid,1,1);

    ok.setText(tr("OK"));
    if (global.password == "" and global.username == "")
        ok.setEnabled(false);
    connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed()));
    cancel.setText(tr("Cancel"));
    connect(&cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed()));
    buttonGrid.addWidget(&ok, 1, 1);
    buttonGrid.addWidget(&cancel, 1,2);
    grid.addLayout(&buttonGrid,2,1);
    grid.setSizeConstraint( QLayout::SetFixedSize );
    this->setFont(global.getGuiFont(font()));
}
Exemplo n.º 3
0
// Constructor. Thys happens when the class is declared.
NotebookProperties::NotebookProperties(QWidget *parent) :
    QDialog(parent)
{
    okPressed = false;
    setWindowTitle(tr("Notebook"));
    setWindowIcon(global.getIconResource(":notebookSmallIcon"));
    setLayout(&grid);

    syncBox.setText(tr("Synchronized"));
    syncBox.setChecked(true);
    syncBox.setEnabled(false);

    defaultNotebook.setText(tr("Default"));
    defaultNotebook.setChecked(false);
    defaultNotebook.setEnabled(true);

    connect(&name, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput()));

    nameLabel.setText(tr("Name"));
    queryGrid.addWidget(&nameLabel, 1,1);
    queryGrid.addWidget(&name, 1, 2);
    queryGrid.addWidget(&syncBox, 2,2);
    queryGrid.addWidget(&defaultNotebook, 3,2);
//    queryGrid.setContentsMargins(10, 10,  -10, -10);
    grid.addLayout(&queryGrid,1,1);

    ok.setText(tr("OK"));
    connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed()));
    cancel.setText(tr("Cancel"));
    connect(&cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed()));
    buttonGrid.addWidget(&ok, 1, 1);
    buttonGrid.addWidget(&cancel, 1,2);
    grid.addLayout(&buttonGrid,2,1);
    this->setFont(global.getGuiFont(font()));
}
Exemplo n.º 4
0
EnDecryptDialog::EnDecryptDialog(QWidget *parent) :
    QDialog(parent)
{
    okPressed = false;
    setWindowTitle(tr("Decrypt"));
    setWindowIcon(QIcon(":password.png"));
    setLayout(&grid);

    connect(&password, SIGNAL(textChanged(const QString&)), this, SLOT(validateInput()));

    hintLabel.setText(tr("Userid"));
    passwordLabel.setText(tr("Password"));
    passwordGrid.addWidget(&passwordLabel, 1,1);
    passwordGrid.addWidget(&password, 1, 2);
    passwordGrid.addWidget(&hintLabel, 2,1);
    passwordGrid.addWidget(&hint, 2, 2);
    passwordGrid.setContentsMargins(10, 10,  -10, -10);
    grid.addLayout(&passwordGrid,1,1);

    ok.setText(tr("OK"));
    if (global.password == "" and global.username == "")
        ok.setEnabled(false);
    connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed()));
    cancel.setText(tr("Cancel"));
    connect(&cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed()));
    buttonGrid.addWidget(&ok, 1, 1);
    buttonGrid.addWidget(&cancel, 1,2);
    grid.addLayout(&buttonGrid,2,1);
    grid.setSizeConstraint( QLayout::SetFixedSize );
}
Exemplo n.º 5
0
void doProbe( void )
{
	runstate = PROBING_STATE;
	
	ADMUX = (1<<REFS0)|(1<<MUX1);					// ref. voltage = AVcc, channel = ADC2
	ADCSRA = (1<<ADPS2)|(1<<ADIE);					// 1:16 prescaler
	
	_delay_ms( 300 );
	
	ADCSRA |= (1<<ADEN);							// enable ADC
	ADCSRA |= (1<<ADSC);							// start first conversion
	
	probingphase = PROBING_START;
	
	// take some time to take a measurement without the motor running, go to sleep and wake up if the measurements are done
	set_sleep_mode( SLEEP_MODE_ADC );
	sleep_mode();
	
	OPTO_SENSOR_ON;
	
	openValve();
	
	while( !okButtonPressed() ) ;
	
	closeValve();
	
	while( !okButtonPressed() ) ;

	openValve();
	
	probingphase = PROBING_END;

	ADCSRA &= ~((1<<ADEN)|(1<<ADIE));				// disable ADC

	OPTO_SENSOR_OFF;
	
	_delay_ms( 300 );

	runstate = NORMAL_STATE;
}	
Exemplo n.º 6
0
EnCryptDialog::EnCryptDialog(QWidget *parent) :
    QDialog(parent)
{

    wasOkPressed = false;
    setWindowTitle(tr("Encrypt Text"));
    //setWindowIcon(new QIcon(iconPath+"password.png"));
    QGridLayout *grid = new QGridLayout(this);
    QGridLayout *input = new QGridLayout(this);
    QGridLayout *msgGrid = new QGridLayout(this);
    QGridLayout *button = new QGridLayout(this);
    setLayout(grid);


    hint.setText("");
    password.setText("");
    password.setEchoMode(QLineEdit::Password);
    password2.setText("");
    password2.setEchoMode(QLineEdit::Password);


    input->addWidget(new QLabel(tr("Password"), this), 1,1);
    input->addWidget(&password, 1, 2);
    input->addWidget(new QLabel(tr("Verify"), this), 2,1);
    input->addWidget(&password2, 2, 2);
    input->addWidget(new QLabel(tr("Hint"), this), 3,1);
    input->addWidget(&hint, 3, 2);
    input->addWidget(new QLabel(tr("Remember Password")), 4,1);
    input->addWidget(&rememberPassword, 4,2);
    input->setContentsMargins(10, 10,  -10, -10);
    grid->addLayout(input, 1,1);

    msgGrid->addWidget(&error, 1, 1);
    grid->addLayout(msgGrid, 2, 1);

    ok.setText(tr("OK"));
    connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed()));
    ok.setEnabled(false);

    QPushButton *cancel = new QPushButton(tr("Cancel"), this);
    connect(cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed()));
    button->addWidget(&ok, 1, 1);
    button->addWidget(cancel, 1,2);
    grid->addLayout(button, 3, 1);

    connect(&password, SIGNAL(textChanged(QString)), this, SLOT(validateInput()));
    connect(&password2, SIGNAL(textChanged(QString)), this, SLOT(validateInput()));
    connect(&hint, SIGNAL(textChanged(QString)), this, SLOT(validateInput()));
    this->setFont(global.getGuiFont(font()));

}
//==============================================================================
void FileChooserDialogBox::buttonClicked (Button* button)
{
    if (button == &(content->okButton))
    {
        okButtonPressed();
    }
    else if (button == &(content->cancelButton))
    {
        closeButtonPressed();
    }
    else if (button == &(content->newFolderButton))
    {
        createNewFolder();
    }
}
CDeckSaveWidget::CDeckSaveWidget(const CDeck &deck, EOptimizationMode optMode, QWidget *parent)
: QWidget(parent)
, mUi(new Ui::DeckSaveWidget)
, mResult(EDeckSaveCancel)
{
    mUi->setupUi(this);

    CDeckTable &decks = CDeckTable::getDeckTable();
    QStringList customDecks;
    decks.getCustomDecks(customDecks);
    customDecks.sort();
    mUi->deckSaveBox->updateHistory(customDecks);
    mUi->deckSaveBox->setEditText(CDeckSaveWidget::buildDeckName(deck, optMode));

    connect(mUi->okButton, SIGNAL(clicked()),
        this, SLOT(okButtonPressed()));
    connect(mUi->cancelButton, SIGNAL(clicked()),
        this, SLOT(cancelButtonPressed()));
}
Exemplo n.º 9
0
LocationDialog::LocationDialog(QWidget *parent) :
    QDialog(parent)
{
    wasOkPressed = false;
    setWindowTitle(tr("Location"));
    //setWindowIcon(new QIcon(iconPath+"password.png"));
    QGridLayout *grid = new QGridLayout(this);
    QGridLayout *input = new QGridLayout(this);
    QGridLayout *button = new QGridLayout(this);
    setLayout(grid);

    input->addWidget(new QLabel(tr("Longitude"), this), 1,1);
    input->addWidget(&longitude, 1, 2);
    input->addWidget(new QLabel(tr("Latitude"), this), 2,1);
    input->addWidget(&latitude, 2, 2);
    input->addWidget(new QLabel(tr("Altitude"), this), 3,1);
    input->addWidget(&altitude, 3, 2);
    input->setContentsMargins(10, 10,  -10, -10);
    grid->addLayout(input, 1,1);

    ok.setText(tr("OK"));
    connect(&ok, SIGNAL(clicked()), this, SLOT(okButtonPressed()));

    QPushButton *cancel = new QPushButton(tr("Cancel"), this);
    connect(cancel, SIGNAL(clicked()), this, SLOT(cancelButtonPressed()));
    button->addWidget(&ok, 1, 1);
    button->addWidget(cancel, 1,2);
    grid->addLayout(button, 3, 1);

    longlatval.setBottom(-90.0);
    longlatval.setTop(90.0);
    longlatval.setNotation(QDoubleValidator::StandardNotation);
    longitude.setValidator(&longlatval);
    latitude.setValidator(&longlatval);

    altitudeval.setBottom(-1500);
    altitudeval.setTop(9999.99);
    altitudeval.setNotation(QDoubleValidator::StandardNotation);
    altitude.setValidator(&altitudeval);
}
Exemplo n.º 10
0
int main(void)
{
    initRTC();
    initControls();
    initLCD();
    initValve();

    // timer0 is being used as a global 'heartbeat'
    // i.e. for blinking in the LCD
    // and for running a temperature check at regular intervals
    TCCR0A = (1<<CS02)|(1<<CS00);	// timer clock = system clock / 1024
    TIFR0 = (1<<TOV0);				// clear pending interrupts
    TIMSK0 = (1<<TOIE0);			// enable timer0 overflow Interrupt

    sei();							// Enable Global Interrupts

    // start a probe run to find the "fully open" and "fully closed" positions
    doProbe();

    // initialize the NTC sensor and start the 1st measurement
    // consequent measurements will be done every tick
    initTemp();

    runstate = NORMAL_STATE;

    while (1)
    {
        if( adcTemp < targetTemp && valvestate != VALVE_OPEN )
        {
            openValve();
        }
        else if( valvestate != VALVE_CLOSED )
        {
            closeValve();
        }

        if( menuButtonPressed() )
        {
            switch( runstate )
            {
            case NORMAL_STATE :
                runstate = MENU_STATE;
                break;

            default :
                runstate = NORMAL_STATE;
                break;
            }
        } // end if( menuButtonPressed )

        if( timeButtonPressed() )
        {
            switch( runstate )
            {
            case NORMAL_STATE :
                runstate = TIMESET_STATE;
                timesetphase = TIMESET_START;

                _delay_ms( 500 );

                // show time with hours blinking
                timesetphase = TIMESET_YEAR;
                break;

            default :
                runstate = NORMAL_STATE;
                break;
            }
        } // end if( timeButtonPressed )

        if( okButtonPressed() )
        {
            switch( runstate )
            {
            case MENU_STATE :
                switch( mainmenu )
                {
                case TEMP :
                    runstate = TEMPSET_STATE;
                    break;

                case TIME :
                    runstate = TIMESET_STATE;
                    timesetphase = TIMESET_START;

                    _delay_ms( 500 );

                    // show time with hours blinking
                    timesetphase = TIMESET_YEAR;
                    break;

                default:
                    break;
                }
                break;

            case TEMPSET_STATE :
                runstate = MENU_STATE;
                break;

            case TIMESET_STATE :
                switch( timesetphase )
                {
                case TIMESET_YEAR :
                    timesetphase = TIMESET_MONTH;
                    break;

                case TIMESET_MONTH :
                    timesetphase = TIMESET_DATE;
                    break;

                case TIMESET_DATE :
                    timesetphase = TIMESET_HOURS;
                    break;

                case TIMESET_HOURS :
                    timesetphase = TIMESET_MINUTES;
                    break;

                case TIMESET_MINUTES :
                    timesetphase = TIMESET_YEAR;
                    break;

                default :
                    break;
                }
                break;

            default :
                break;
            }
        } // end if( okButtonPressed )

        ROTARYBUTTON rotaryButton = readRotaryButton();

        if( rotaryButton == ROTARY_UP )
        {
            switch( runstate )
            {
            case NORMAL_STATE :
            case MENU_STATE :
                mainmenu++;
                if( mainmenu == LAST_ITEM )
                    mainmenu = 0;
                break;

            case TIMESET_STATE :
                increaseClock( timesetphase );
                break;

            case TEMPSET_STATE :
                if( targetTemp >= 500 )
                    targetTemp = 0;
                else
                    targetTemp += 5;
                break;

            default :
                break;
            }
        } // end if( BUTTON_UP_PRESSED )

        if( rotaryButton == ROTARY_DOWN )
        {
            switch( runstate )
            {
            case NORMAL_STATE :
            case MENU_STATE :
                if( mainmenu == 0 )
                    mainmenu = LAST_ITEM;
                mainmenu--;
                break;

            case TIMESET_STATE :
                decreaseClock( timesetphase );
                break;

            case TEMPSET_STATE :
                if( targetTemp == 0 )
                    targetTemp = MAXTEMP;
                else
                    targetTemp -= 5;
                break;

            default :
                break;
            }
        } // end if( BUTTON_DOWN_PRESSED )

        // go to sleep but wake up if any button is pressed
        set_sleep_mode( SLEEP_MODE_ADC );
        sleep_mode();

    } // end while forever

}