Esempio n. 1
0
squeeze::squeeze()
    : KXmlGuiWindow( ),
      m_view(new squeezeView(this)),
      m_printer(0)
{
    setObjectName(QLatin1String("squeeze"));
    // accept dnd
    setAcceptDrops(false);

    // tell the KXmlGuiWindow that this is indeed the main widget
    setCentralWidget(m_view);

    // then, setup our actions
    setupActions();
    //Add some widgets to status bar
    led = new KLed;
    led->off();
    statusBar()->addWidget(led); //FIXME: Que cuando se escriba algo en la barra de status, quede el LED ahi tambien.
    // add a status bar
    statusBar()->show();

    // Add typical actions and save size/toolbars/statusbar
    setupGUI();
    disableUI();
    // allow the view to change the statusbar and caption
    connect(m_view, SIGNAL(signalChangeStatusbar(const QString&)),
            this,   SLOT(changeStatusbar(const QString&)));
    connect(m_view, SIGNAL(signalChangeCaption(const QString&)),
            this,   SLOT(changeCaption(const QString&)));

    connect(m_view, SIGNAL(signalDisconnected()), this, SLOT(setDisconnected()));
    connect(m_view, SIGNAL(signalConnected()), this, SLOT(setConnected()));

    connect(m_view, SIGNAL(signalShowPrefs()), SLOT(optionsPreferences()) );

    connect(m_view, SIGNAL(signalSalir() ), SLOT(salir() ));

    connect(m_view, SIGNAL(signalShowDbConfig()), this, SLOT(showDBConfigDialog()));


    connect(m_view, SIGNAL(signalAdminLoggedOn()), this, SLOT(enableUI()));
    connect(m_view, SIGNAL(signalAdminLoggedOff()), this, SLOT(disableUI()));
    connect(m_view, SIGNAL(signalSupervisorLoggedOn()), this, SLOT(enableUI()));


    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(fixGeom()));
    timer->setInterval(5000);
    timer->start();
    

    loadStyle();
}
Esempio n. 2
0
void MainWindow::on_tbLogout_clicked()
{

    user=0;
    db.close();
    disableUI();
}
Esempio n. 3
0
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
    ui(new Ui::MainWindow)
{
  QSettings settings("hamletmod");

    ui->setupUi(this);
    //enableDB();
    setFocusPolicy(Qt::StrongFocus);
    sConn=settings.value("conn").toString();

   // ui->pbOldCards->setVisible(false);

  //  installEventFilter(this);





this->showMaximized();



disableUI();

}
Esempio n. 4
0
void squeeze::setConnection(bool yes)
{
  if ( yes ) {
    led->on();
    enableUI();
  } else {
    led->off();
    disableUI();
  }
}
Esempio n. 5
0
void squeeze::setConnection(bool yes)
{
  if ( yes ) {
    led->on();
    enableUI();
  } else {
    led->off();
    disableUI();
    showDBConfigDialog();
  }
}
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent),
    ui(new Ui::MainWindow)
{
  QSettings settings("DB");

    ui->setupUi(this);
  //  ui->tbAnalisi->setVisible(false);
  //  enableDB();
//enableButtonsForRole(true);
   // this->showMaximized();

   // enableDB();

  sConn=settings.value("conn").toString();
  user= new HUser();
  user->init(sConn);

this->showMaximized();
  ui->pbSchede->setVisible(false);

disableUI();

}
void MainWindow::on_tbLogout_clicked()
{

    user->init(sConn);
     disableUI();
}
void MainWindow::enableButtonsForRole()
{


    if (user->getID()==-1)
    {
        //disabilito tutto>logout
        disableUI();

    }

    int rol=user->getRole();

    qDebug()<<QString::number(rol);

    switch(user->getRole())
    {
    case 1:

        break;

    case 2:
        // qui abilito tutto essendo un utente con privilegi amministrativi

        ui->tnProduzione->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->toolButton->setEnabled(false);
        ui->tbMagaz->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbClose->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbModificaLotti->setEnabled(true);
        ui->tbSettings->setEnabled(true);
        ui->tnProduzione->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->tbAssociazioni->setEnabled(true);
        ui->tbUtenti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbPackages->setEnabled(true);


     //   ui->pbRicercaLotto->setEnabled(true);

        break;

    case 3:
        ui->tbMagaz->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->tbModificaLotti->setEnabled(false);
        ui->tnProduzione->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        break;
    case 4://simone
        ui->tbMagaz->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->tbModificaLotti->setEnabled(false);
        ui->tnProduzione->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        ui->tbModificaLotti->setEnabled(true);

        break;
     case 5://amministrativo
        ui->toolButton->setEnabled(false);
        ui->tbMagaz->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbClose->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbModificaLotti->setEnabled(true);
        ui->tbSettings->setEnabled(true);
        ui->tnProduzione->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->tbAssociazioni->setEnabled(true);
        ui->tbUtenti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbPackages->setEnabled(true);
        break;
     case 6:
        ui->tnProduzione->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->toolButton->setEnabled(false);
        ui->tbMagaz->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbClose->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbModificaLotti->setEnabled(true);
        ui->tbSettings->setEnabled(false);
        ui->tnProduzione->setEnabled(true);
        ui->tbAnalisi->setEnabled(false);
        ui->pBNewOperation->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->tbAssociazioni->setEnabled(false);
        ui->tbUtenti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbPackages->setEnabled(true);



    }


}
controlMainWindow::controlMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::controlMainWindow)
{
    ui->setupUi(this);
    ui->statusBar->addWidget(&m_txWidget);
    connect(&m_socketClient,SIGNAL(tx()),&m_txWidget,SLOT(tx()));
    connect(&m_socketClient,SIGNAL(rx()),&m_txWidget,SLOT(rx()));
//Botones para la barra de herramientas:
    QToolButton* btnConnect     = new QToolButton(this);
    btnConnect->setMinimumSize(64,64);
    btnConnect->setMaximumSize(64,64);
    btnConnect->setIcon(QIcon(":/icons/icons/connect-icon.png"));
        btnConnect->setIconSize(QSize(64,64));
    connect(btnConnect,SIGNAL(toggled(bool)),ui->connectionWidget,SLOT(connectSocket(bool)));
    btnConnect->setCheckable(true);

    QToolButton* btnShowSensors = new QToolButton(this);
    btnShowSensors->setText("Sensors");
    btnShowSensors->setCheckable(true);
    btnShowSensors->setChecked(false);
    connect(btnShowSensors,SIGNAL(toggled(bool)),ui->sensorViewWidget,SLOT(setVisible(bool)));
    connect(btnShowSensors,SIGNAL(toggled(bool)),&m_socketClient,SLOT(requestSensorData(bool)));

    QToolButton* btnShowBright  = new QToolButton(this);
    btnShowBright->setText("Bright");
    btnShowBright->setCheckable(true);
    btnShowBright->setChecked(false);
    connect(btnShowBright,SIGNAL(toggled(bool)),ui->groupBrightness,SLOT(setVisible(bool)));

    QToolButton* btnOffsetTool = new QToolButton(this);
    btnOffsetTool->setText("OffsetTool");
    btnOffsetTool->setCheckable(true);
    btnOffsetTool->setChecked(false);
    connect(btnOffsetTool,SIGNAL(toggled(bool)),ui->groupOffset ,SLOT(setVisible(bool)));

    QToolButton* btnShowEffects = new QToolButton(this);
    btnShowEffects->setText("Effects");
    btnShowEffects->setCheckable(true);
    btnShowEffects->setChecked(true);
    connect(btnShowEffects,SIGNAL(toggled(bool)),ui->effectsWidget ,SLOT(setVisible(bool)));

    ui->mainToolBar->addWidget(btnConnect);
    ui->mainToolBar->addWidget(btnShowSensors);
    ui->mainToolBar->addWidget(btnShowBright);
    ui->mainToolBar->addWidget(btnShowEffects);
    ui->mainToolBar->addWidget(btnOffsetTool);
//
    ui->sensorViewWidget->hide();
//    ui->effectsWidget->hide();
    ui->groupBrightness->hide();
    ui->groupOffset->hide();

    connect(ui->connectionWidget,SIGNAL(ready())    ,this,SLOT(enableUI()));
    connect(ui->connectionWidget,SIGNAL(notReady()) ,this,SLOT(disableUI()));

    ui->connectionWidget->setClient(&m_socketClient);
    ui->sensorViewWidget->setClient(&m_socketClient);

    connect(ui->btnOff,           SIGNAL(clicked(bool)),&m_socketClient,    SLOT(off()));
    connect(ui->btnNext,          SIGNAL(clicked(bool)),&m_socketClient,    SLOT(nextEffect()));
    connect(ui->btnPrev,          SIGNAL(clicked(bool)),&m_socketClient,    SLOT(prevEffect()));
    connect(ui->btnCircle,        SIGNAL(clicked(bool)),&m_socketClient,    SLOT(animationCircle()));
    connect(ui->btnDoubleCircle,  SIGNAL(clicked(bool)),&m_socketClient,    SLOT(animationDoubleCircle()));
    connect(ui->btnRainbow,       SIGNAL(clicked(bool)),&m_socketClient,    SLOT(animationRainbow()));
    connect(ui->btnFlash ,        SIGNAL(clicked(bool)),&m_socketClient,    SLOT(animationFlash()));
    connect(ui->btnSetColor,      SIGNAL(clicked(bool)),this,               SLOT(setColor()));
    connect(ui->sliderBrightness, SIGNAL(valueChanged(int)),this,           SLOT(setBrightness(int)));
    connect(ui->dialOffset,       SIGNAL(valueChanged(int)),&m_socketClient,SLOT(setOffset(int)));

    disableUI();
}
Esempio n. 10
0
void MainWindow::enableButtonsForRole()
{


    if (user->getID()==-1)
    {
        //disabilito tutto>logout
        disableUI();

    }

    int rol=user->getRole();

    //// qDebug()<<QString::number(rol);

    ui->pbVerifyLabels->setEnabled(true);

    switch(user->getRole())
    {
    case 1:

        //produzione

        ui->tnProduzione->setEnabled(true);
        ui->pbUnload->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->toolButton->setEnabled(false);
        ui->tbMagaz->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbClose->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbModificaLotti->setEnabled(true);
        ui->tbSettings->setEnabled(false);
        ui->tnProduzione->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->pbOldCards->setEnabled(true);
        ui->tbAssociazioni->setEnabled(false);
        ui->tbUtenti->setEnabled(false);
        ui->tbLogout->setEnabled(true);
        ui->pbPackages->setEnabled(true);
        ui->pbNotifiche->setEnabled(false);
        ui->pbContacts->setEnabled(false);
        ui->pbCkeckNotifications->setEnabled(true);


        break;

    case 2:
        // magazzino


     //   ui->pbRicercaLotto->setEnabled(true);
        ui->tnProduzione->setEnabled(false);
        ui->tbLogout->setEnabled(true);
        ui->toolButton->setEnabled(true);
        ui->tbMagaz->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbClose->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbModificaLotti->setEnabled(true);
        ui->tbSettings->setEnabled(true);
        ui->tnProduzione->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->tbAssociazioni->setEnabled(true);
        ui->pbOldCards->setEnabled(true);
        ui->tbUtenti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbPackages->setEnabled(true);
        ui->pbUnload->setEnabled(true);
        ui->pbContacts->setEnabled(false);
        ui->pbNotifiche->setEnabled(false);
        ui->pbCkeckNotifications->setEnabled(true);


        break;

    case 3:
        //uffici
        ui->tbMagaz->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->pbOldCards->setEnabled(true);
        ui->tbModificaLotti->setEnabled(false);
        ui->tnProduzione->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        ui->pbUnload->setEnabled(true);
        ui->pbContacts->setEnabled(true);
        ui->pbNotifiche->setEnabled(true);
        ui->pbCkeckNotifications->setEnabled(true);

        break;
    case 4://simone
        ui->tbMagaz->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->pbOldCards->setEnabled(true);
        ui->tbModificaLotti->setEnabled(false);
        ui->tnProduzione->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        ui->tbModificaLotti->setEnabled(true);
        ui->pbUnload->setEnabled(true);
        ui->pbContacts->setEnabled(false);
        ui->pbNotifiche->setEnabled(false);
        ui->pbCkeckNotifications->setEnabled(true);

        break;
     case 5://amministrativo
        ui->toolButton->setEnabled(false);
        ui->tbMagaz->setEnabled(true);
        ui->tbLotti->setEnabled(true);
        ui->tbAnag->setEnabled(true);
        ui->tbClose->setEnabled(true);
        ui->tbProdotti->setEnabled(true);
        ui->tbRicette->setEnabled(true);
        ui->tbModificaLotti->setEnabled(true);
        ui->tbSettings->setEnabled(true);
        ui->tnProduzione->setEnabled(true);
        ui->tbAnalisi->setEnabled(true);
        ui->pBNewOperation->setEnabled(true);
        ui->pbSchede->setEnabled(true);
        ui->pbOldCards->setEnabled(true);
        ui->tbAssociazioni->setEnabled(true);
        ui->tbUtenti->setEnabled(true);
        ui->tbLogout->setEnabled(true);
        ui->pbPackages->setEnabled(true);
        ui->pbUnload->setEnabled(true);
        ui->pbContacts->setEnabled(true);
        ui->pbNotifiche->setEnabled(true);
        ui->pbCkeckNotifications->setEnabled(true);

        break;
     case 6:
        ui->tnProduzione->setEnabled(false);
        ui->tbLogout->setEnabled(false);
        ui->toolButton->setEnabled(true);
        ui->tbMagaz->setEnabled(false);
        ui->tbLotti->setEnabled(false);
        ui->tbAnag->setEnabled(false);
        ui->tbClose->setEnabled(false);
        ui->tbProdotti->setEnabled(false);
        ui->tbRicette->setEnabled(false);
        ui->tbModificaLotti->setEnabled(false);
        ui->tbSettings->setEnabled(false);
        ui->tnProduzione->setEnabled(false);
        ui->tbAnalisi->setEnabled(false);
        ui->pBNewOperation->setEnabled(false);
        ui->pbSchede->setEnabled(false);
        ui->pbOldCards->setEnabled(false);
        ui->tbAssociazioni->setEnabled(false);
        ui->tbUtenti->setEnabled(false);
        ui->tbLogout->setEnabled(false);
        ui->pbPackages->setEnabled(true);
        ui->pbUnload->setEnabled(false);
        ui->pbContacts->setEnabled(false);
        ui->pbNotifiche->setEnabled(false);
        ui->pbNotifiche->setEnabled(false);
        ui->pbCkeckNotifications->setEnabled(false);




    }



}