Example #1
0
void ButtonSettings::slotAddDlgClosed( int key )
{
    if( key > 0 ) {
        odebug << "**** Add button " << ODevice::keyToString( key ) << oendl;
        delete m_addWidget;
        m_addWidget = 0;

        buttoninfo *bi = buttonInfoForKeycode( key );
        if( bi ) {
            QMessageBox::warning ( this, tr( "Already bound" ), tr( "The pressed button is already in the list." ));
            return;
        }

        // Get a name for the key
        QDialog *dlg = new QDialog( this, 0, true );
        QVBoxLayout *lay = new QVBoxLayout( dlg );
        QLabel *l = new QLabel( tr("Please enter a name for this button"), dlg );
        lay->addWidget(l);
        QLineEdit *le = new QLineEdit( dlg );
        lay->addWidget(le);
        lay->addStretch(1);
        dlg->setGeometry( qApp->desktop()->width() / 8, (qApp->desktop()->height() / 2) - 25,
                 3 * (qApp->desktop()->width() / 4), 50 );
        dlg->setCaption( tr( "Button name" ) );
        dlg->show();
        if( dlg->exec() == QDialog::Accepted ) {
            ODevice::inst()->registerCustomButton( key, le->text(), "" );
            addButtonItem( ODevice::inst()->buttons().last() );
            updateLabels();
            m_customChanged = true;
        }

    }
}
Example #2
0
int Busqueda_on_mui_buscar_clicked ( BlSearchWidget *busq )
{
    if ( busq->tableName() == "cliente" ) {

        QDialog *diag = new QDialog ( 0 );
        diag->setModal ( true );
        diag->setGeometry ( QRect ( 0, 0, 750, 550 ) );
        blCenterOnScreen ( diag );

        ClientsList *clients = new ClientsList ( ( BfCompany * ) busq->mainCompany(), diag, 0, BL_SELECT_MODE );
        busq->connect ( clients, SIGNAL ( selected ( QString ) ), diag, SLOT ( accept() ) );

        /// Creamos un layout donde estara el contenido de la ventana y la ajustamos al QDialog
        /// para que sea redimensionable y aparezca el titulo de la ventana.
        QHBoxLayout *layout = new QHBoxLayout;
        layout->addWidget ( clients );
        layout->setMargin ( 0 );
        layout->setSpacing ( 0 );
        diag->setLayout ( layout );
        diag->setWindowTitle ( clients->windowTitle() );

        diag->exec();

        if ( clients->idclient() != "" ) {
            busq->setId ( clients->idclient() );
        } // end if

        delete diag;
        return 1;
    } // end if

    return 0;
}
    void addView()
    {
        // the new View we want to add:
        osgViewer::View* view = new osgViewer::View();

        // a widget to hold our view:
        QWidget* viewWidget = new osgEarth::QtGui::ViewWidget(view);

        // a dialog to hold the view widget:
        QDialog* win = new QDialog(this);
        win->setModal( false );
        win->setLayout( new QHBoxLayout() );
        win->layout()->addWidget( viewWidget );
        int x = osgEarth::Random().next( 1024 );
        int y = osgEarth::Random().next( 768 );
        win->setGeometry( x, y, 640, 480 );
        win->show();

        // set up the view
        view->setCameraManipulator( new osgEarth::Util::EarthManipulator );
        view->setSceneData( _scene.get() );  
        view->getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true,false);

        // add it to the composite viewer.
        _viewer.addView( view );
    }
Example #4
0
void MainWindow::on_actShowStat_triggered()
{
  QString query = QString("call p_showStat_admin('%1', '%2', 0);")
      .arg(_model->dateA_dbformat())
      .arg(_model->dateZ_dbformat());
  qDebug() << query;
  QSqlQueryModel *m = App::theApp()->db_model(query);

  QDialog *dlgStat = new QDialog();
  dlgStat->setWindowTitle("Статистика");
  dlgStat->setGeometry(200, 200, 400, 200);

  QTableView* view = new QTableView();
  view->setModel(m);
  view->resizeColumnsToContents();
  view->resizeRowsToContents();

  QVBoxLayout* lay = new QVBoxLayout(dlgStat);
  lay->addWidget(view);

  dlgStat->exec();
}
Example #5
0
bool ButtonDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
{
    if (event->type() == QEvent::MouseButtonPress) {

        QMouseEvent* e =(QMouseEvent*)event;

        if (option.rect.adjusted(4, 4, -4, -4).contains(e->x(), e->y()) && m_btns.contains(index)) {
            m_btns.value(index)->state |= QStyle::State_Sunken;
        }
    }
    if (event->type() == QEvent::MouseButtonRelease) {
        QMouseEvent* e =(QMouseEvent*)event;

        if (option.rect.adjusted(4, 4, -4, -4).contains(e->x(), e->y()) && m_btns.contains(index)) {
            m_btns.value(index)->state &= (~QStyle::State_Sunken);

            QDialog *d = new QDialog();

            d->setGeometry(0, 0, 200, 200);
            d->move(QApplication::desktop()->screenGeometry().center() - d->rect().center());
            d->show();
        }
    }
}
Example #6
0
 bool outputListDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
 {
     if( event->type() == QEvent::MouseButtonRelease )
     {
         QMouseEvent * e = (QMouseEvent *)event;
         int clickX = e->x();
         int clickY = e->y();

         QRect r = option.rect;//getting the rect of the cell
         int x,y,w,h;
         x = r.left() + r.width() - 30;//the X coordinate
         y = r.top();//the Y coordinate
         w = 30;//button width
         h = 30;//button height

         if( clickX > x && clickX < x + w )
             if( clickY > y && clickY < y + h )
             {
                 QDialog * d = new QDialog();
                 d->setGeometry(0,0,100,100);
                 d->show();
             }
     }
 }
Example #7
0
void Config::ShowConfig()
{

    // create dialog
    QDialog *window = new QDialog;

    // Config Logo header
    QPixmap *pixLogo = new QPixmap;

    // load logo image from file
    pixLogo->load(":/images/cst_config_logo.png");

    // show logo file on label
    QLabel *labelConfigLogo = new QLabel;
    labelConfigLogo->setPixmap(*pixLogo);
    labelConfigLogo->setFrameStyle(QFrame::Panel | QFrame::Sunken);
    labelConfigLogo->setLineWidth(2);

    tabWidget = new QTabWidget;

    recordTab = new RecordingTab;
    userTab = new UserTab;
    generalTab = new GeneralTab;

    tabWidget->addTab(recordTab, tr("&Recording"));
    tabWidget->addTab(userTab, tr("&User"));
    tabWidget->addTab(generalTab, tr("&General"));

    // Buttons
    QHBoxLayout *hButtonBox = new QHBoxLayout;
    hButtonBox->addStretch(1);

    // create ok button
    QPushButton *okButton = new QPushButton(tr("&Ok"));

    // set ok button to default and accept
    connect(okButton, SIGNAL(clicked()), this, SLOT(SaveSettings()));
    connect(this, SIGNAL(SavedSettings()), window, SLOT(accept()));

    // create cancel button
    QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
    connect(cancelButton, SIGNAL(clicked()), window, SLOT(reject()));
    cancelButton->setDefault(false);

    hButtonBox->addWidget(okButton);
    hButtonBox->addWidget(cancelButton);

    // everything
    QVBoxLayout *vBox = new QVBoxLayout(window);
    vBox->addWidget(labelConfigLogo);
    vBox->addWidget(tabWidget);				// configuration tabs
    vBox->addLayout(hButtonBox);		// ok and cancel buttons

    window->setLayout(vBox);
    okButton->setDefault(true);

    window->setGeometry(200,200,400,50);
    window->setWindowTitle("VoiceLog1 Configuration");
    window->setWindowIcon(QIcon(QPixmap(":/images/icons/appIcon.png")));

    // create our settings object
    QSettings voiceLogSettings;

    // get the recording settings
    recordTab->editRecPath->setText(voiceLogSettings.value("config/recording/Path").toString());			// the path of the recordings - usually app directory
    recordTab->editRecName->setText(voiceLogSettings.value("config/recording/Name").toString());			// record file name
    recordTab->spinThreshTimer->setValue(voiceLogSettings.value("config/recording/Timer").toInt());	// under threshold timer

    // get the user settings
    userTab->editCompany->setText(voiceLogSettings.value("config/user/Company").toString());				// company name
    userTab->editDept->setText(voiceLogSettings.value("config/user/Department").toString());										// department
    userTab->editUser->setText(voiceLogSettings.value("config/user/Username").toString());				// username

    // get general settings
    generalTab->checkStart->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/AutoStart").toInt()));				// auto start
    generalTab->checkConfig->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/AllowConfig").toInt()));				// allow access to configuration
    generalTab->checkDeactivate->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/AllowDeactivate").toInt()));		// allow access to deactivation
    generalTab->checkPlayback->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/AllowPlayback").toInt()));			// allow playback of recordings
    generalTab->checkHidden->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/GoStealth").toInt()));				// go into stealth mode - set process id different and no gui
    generalTab->checkComments->setCheckState(Qt::CheckState(voiceLogSettings.value("config/general/Comments").toInt()));				// go into stealth mode - set process id different and no gui

    window->exec();
}
Example #8
0
void UserTab::ChangeUserPassword()
{
    // create dialog
    QDialog *passwordDialog = new QDialog;

    // Old password
    QLabel *labelUserOldPass = new QLabel;
    labelUserOldPass->setText("&Old Password");


    editUserOldPass = new QLineEdit();
    editUserOldPass->setFixedWidth(180);
    editUserOldPass->setEchoMode(QLineEdit::Password);

    labelUserOldPass->setBuddy(editUserOldPass);

    // New password
    QLabel *labelUserNewPass = new QLabel;
    labelUserNewPass->setText("&New Password");

    editUserNewPass = new QLineEdit();
    editUserNewPass->setFixedWidth(180);
    editUserNewPass->setEchoMode(QLineEdit::Password);

    labelUserNewPass->setBuddy(editUserNewPass);

    // New password confirm
    QLabel *labelUserNewPassRep = new QLabel;
    labelUserNewPassRep->setText("&Confirm Password");

    editUserNewPassRep = new QLineEdit();
    editUserNewPassRep->setFixedWidth(180);
    editUserNewPassRep->setEchoMode(QLineEdit::Password);

    labelUserNewPassRep->setBuddy(editUserNewPassRep);

    // Buttons
    QHBoxLayout *hButtonBox = new QHBoxLayout;
    hButtonBox->addStretch(1);

    // create ok button
    QPushButton *okButton = new QPushButton(tr("&Ok"));
    okButton->setDefault(true);

    // set ok button to default and check if passwords match
    connect(okButton, SIGNAL(clicked()), this, SLOT(CheckPassMatches()));
    connect(this, SIGNAL(userPassMatches()), passwordDialog, SLOT(accept()));

    // create cancel button
    QPushButton *cancelButton = new QPushButton(tr("&Cancel"));
    connect(cancelButton, SIGNAL(clicked()), passwordDialog, SLOT(reject()));
    cancelButton->setDefault(false);

    hButtonBox->addWidget(okButton);
    hButtonBox->addWidget(cancelButton);

    // layout for options
    QGridLayout *gBoxPass = new QGridLayout;
    gBoxPass->addWidget(labelUserOldPass, 0, 0);
    gBoxPass->addWidget(editUserOldPass, 0, 1);

    gBoxPass->addWidget(labelUserNewPass, 1, 0);
    gBoxPass->addWidget(editUserNewPass, 1, 1);

    gBoxPass->addWidget(labelUserNewPassRep, 2, 0);
    gBoxPass->addWidget(editUserNewPassRep, 2, 1);

    QVBoxLayout *vBox = new QVBoxLayout(passwordDialog);
    vBox->addLayout(gBoxPass);			// password stuff
    vBox->addLayout(hButtonBox);		// ok and cancel buttons

    passwordDialog->setLayout(vBox);

    passwordDialog->setGeometry(200,200,200,40);

    passwordDialog->setWindowTitle("Change User Password");
    passwordDialog->setWindowIcon(QIcon(QPixmap(":/images/icons/appIcon.png")));

    passwordDialog->exec();
}