Beispiel #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();
}
Beispiel #2
0
void squeeze::setConnection(bool yes)
{
  if ( yes ) {
    led->on();
    enableUI();
  } else {
    led->off();
    disableUI();
  }
}
void  RouterKeygen::checkUpdates(){
    QNetworkAccessManager* mNetworkManager = new QNetworkAccessManager(this);
    QObject::connect(mNetworkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(onNetworkReply(QNetworkReply*)));
    if ( !automaticUpdateCheck ){
        enableUI(false);
        setLoadingAnimation(tr("Checking for updates"));
    }
    QUrl url("https://raw.github.com/routerkeygen/routerkeygenPC/master/routerkeygen_version.json");
    mNetworkManager->get(QNetworkRequest(url));
}
Beispiel #4
0
void squeeze::setConnection(bool yes)
{
  if ( yes ) {
    led->on();
    enableUI();
  } else {
    led->off();
    disableUI();
    showDBConfigDialog();
  }
}
AttributeProfileMgmtDialog::AttributeProfileMgmtDialog(UIDelegate *newUiDelegate, AttributeFilterManagement *newManagement, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AttributeProfileMgmtDialog)
{
    _uiDelegate = newUiDelegate ;
    _mgmt = newManagement;
    _selectedProfileCode = -1 ;
    _selectedProfile = NULL ;
    ui->setupUi(this);
    loadData();
    enableUI();
}
void RouterKeygen::onNetworkReply(QNetworkReply* reply){
    const unsigned int RESPONSE_OK = 200;
    if ( !automaticUpdateCheck ){
        cleanLoadingAnimation();
        enableUI(true);
    }
    if(reply->error() == QNetworkReply::NoError)
    {
        unsigned int httpstatuscode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toUInt();
        switch(httpstatuscode)
        {
        case RESPONSE_OK:
            if (reply->isReadable())
            {
                 QByteArray result;
                 result = reply->readAll();

                 QScriptValue sc;
                 QScriptEngine engine;
                 sc = engine.evaluate("(" +QString(result) + ")");
                 QString version = sc.property("version").toString();
                if ( version == QApplication::applicationVersion() ){
                    if ( !automaticUpdateCheck ){
                        ui->statusBar->showMessage(tr("The application is already at the latest version."));
                    }
                }
                else{
                    //TODO: when the final website is sc.property("url").toString()
                    UpdateDialog * updateDialog = new UpdateDialog(QString("https://code.google.com/p/android-thomson-key-solver/downloads/list"),
                                                                   version, this);
                    updateDialog->show();
                }
            }
            break;
        default:
            if ( !automaticUpdateCheck ){
                ui->statusBar->showMessage(tr("Error while checking for updates"));
            }
            break;
        }
    }
    else {
        if ( !automaticUpdateCheck ){
            ui->statusBar->showMessage(tr("Error while checking for updates"));
        }
    }
    automaticUpdateCheck = false;
    reply->deleteLater();
}
void RouterKeygen::calc(QScanResult * wifi) {
    if (calculator != NULL) {
        return; //ignore while a calculator is still running
    }
    if (wifi->getSupportState() == Keygen::UNSUPPORTED) {
        ui->statusBar->showMessage(
                tr("Unsupported network. Check the MAC address and the SSID."));
        return;
    }
    ui->passwordsList->clear();
    setLoadingAnimation(tr("Calculating keys. This can take a while."));
    this->calculator = new KeygenThread(wifi->getKeygens());
    connect(this->calculator, SIGNAL( finished() ), this, SLOT( getResults() ));
    enableUI(false);
    this->calculator->start();
}
void RouterKeygen::getResults() {
    cleanLoadingAnimation();
    enableUI(true);
    if (calculator->hadError()) {
        ui->statusBar->showMessage(tr("Error while calculating."));
        delete calculator;
        calculator = NULL;
        return;
    }
    listKeys = this->calculator->getResults();
    if (listKeys.isEmpty()) {
        ui->statusBar->showMessage(tr("No keys were calculated."));
        delete calculator;
        calculator = NULL;
        return;
    }
    ui->passwordsList->clear();
    for (int i = 0; i < listKeys.size(); ++i)
        ui->passwordsList->insertItem(0, listKeys.at(i));
    ui->statusBar->showMessage(tr("Calculation finished"));
    delete calculator;
    calculator = NULL;
}
void RouterKeygen::scanFinished(int code) {
    cleanLoadingAnimation();
    enableUI(true);
    switch (code) {
    case QWifiManager::SCAN_OK: {
            foreach ( QSharedPointer<QScanResult> scanResult, wifiNetworks )
                scanResult.clear();
            bool setTabPosition = false;
            if ( wifiNetworks.size() == 0 )
                setTabPosition = true;
            wifiNetworks = wifiManager->getScanResults();
            //Stting the row count to the maximum possible value
            ui->unsupportedNetworkslist->setRowCount(wifiNetworks.size());
            ui->supportedNetworkslist->setRowCount(wifiNetworks.size());
            ui->unlikelyNetworkslist->setRowCount(wifiNetworks.size());
            trayMenu->clear();
            connect(trayMenu->addAction(tr("Open")),
                    SIGNAL(triggered()), this, SLOT(show()));
            trayMenu->addSeparator();
            connect(trayMenu->addAction(tr("Vulnerable networks")),
                    SIGNAL(triggered()), this, SLOT(show()));
            bool foundVulnerable = false;
            int unsupportedPos = 0, supportedPos = 0, unlikelyPos= 0;
           for (int i = 0; i < wifiNetworks.size(); ++i) {
                wifiNetworks.at(i)->checkSupport(*matcher);
                if ( wifiNetworks.at(i)->getSupportState() == Keygen::UNSUPPORTED ){
                    ui->unsupportedNetworkslist->setItem(unsupportedPos, 0,
                                              new QTableWidgetItem(wifiNetworks.at(i)->getSsidName()));
                    ui->unsupportedNetworkslist->setItem(unsupportedPos, 1,
                                              new QTableWidgetItem(wifiNetworks.at(i)->getMacAddress()));
                    QString level;
                    level.setNum(wifiNetworks.at(i)->getLevel(), 10);
                    ui->unsupportedNetworkslist->setItem(unsupportedPos, 2, new QTableWidgetItem(level));
                    ++unsupportedPos;
                }
                else{
                    if ( wifiNetworks.at(i)->getSupportState() == Keygen::SUPPORTED ){
                        ui->supportedNetworkslist->setItem(supportedPos, 0,
                                                   new QTableWidgetItem(wifiNetworks.at(i)->getSsidName()));
                         ui->supportedNetworkslist->setItem(supportedPos, 1,
                                                   new QTableWidgetItem(wifiNetworks.at(i)->getMacAddress()));
                         QString level;
                         level.setNum(wifiNetworks.at(i)->getLevel(), 10);
                         ui->supportedNetworkslist->setItem(supportedPos, 2, new QTableWidgetItem(level));
                         ++supportedPos;
                    }
                    else {//if ( networks.at(i)->getSupportState() == Keygen::MAYBE )
                         ui->unlikelyNetworkslist->setItem(unlikelyPos, 0,
                                                   new QTableWidgetItem(wifiNetworks.at(i)->getSsidName()));
                         ui->unlikelyNetworkslist->setItem(unlikelyPos, 1,
                                                   new QTableWidgetItem(wifiNetworks.at(i)->getMacAddress()));
                         QString level;
                         level.setNum(wifiNetworks.at(i)->getLevel(), 10);
                         ui->unlikelyNetworkslist->setItem(unlikelyPos, 2, new QTableWidgetItem(level));
                         ++unlikelyPos;
                    }
                    addNetworkToTray(wifiNetworks.at(i)->getSsidName(), wifiNetworks.at(i)->getLevel(), wifiNetworks.at(i)->isLocked());
                    foundVulnerable = true;
                }
            }
            //Stting the row count to the correct value
            ui->unsupportedNetworkslist->setRowCount(unsupportedPos);
            ui->supportedNetworkslist->setRowCount(supportedPos);
            ui->unlikelyNetworkslist->setRowCount(unlikelyPos);
            if ( setTabPosition ){
                if ( supportedPos > 0 )
                    ui->networkSplitter->setCurrentIndex(0);
                else if ( unlikelyPos > 0 )
                    ui->networkSplitter->setCurrentIndex(1);
                else
                    ui->networkSplitter->setCurrentIndex(2);
            }
            if (!foundVulnerable) {
                trayMenu->addAction(tr("None were detected"))->setEnabled(false);
            }

            trayMenu->addSeparator();
            trayMenu->addAction(startUpAction);
            trayMenu->addAction(runInBackgroundAction);
            trayMenu->addSeparator();
            connect(trayMenu->addAction(tr("Quit")), SIGNAL(triggered()), qApp, SLOT(quit()));
            if (wifiNetworks.size() == 0) {
                 ui->statusBar->showMessage(tr("None were detected"));
            }
            QStringList headers;
            headers << tr("Name") << tr("MAC") << tr("Strength");
            ui->supportedNetworkslist->setHorizontalHeaderLabels(headers);
            ui->supportedNetworkslist->resizeColumnsToContents();
            ui->supportedNetworkslist->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
            ui->supportedNetworkslist->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);
            ui->supportedNetworkslist->sortByColumn(2); //Order by Strength
            ui->unsupportedNetworkslist->setHorizontalHeaderLabels(headers);
            ui->unsupportedNetworkslist->resizeColumnsToContents();
            ui->unsupportedNetworkslist->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
            ui->unsupportedNetworkslist->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);
            ui->unsupportedNetworkslist->sortByColumn(2); //Order by Strength
            ui->unlikelyNetworkslist->setHorizontalHeaderLabels(headers);
            ui->unlikelyNetworkslist->resizeColumnsToContents();
            ui->unlikelyNetworkslist->horizontalHeader()->setResizeMode(0, QHeaderView::Stretch);
            ui->unlikelyNetworkslist->horizontalHeader()->setResizeMode(1, QHeaderView::Stretch);
            ui->unlikelyNetworkslist->sortByColumn(2); //Order by Strength
            break;
	}
    case QWifiManager::ERROR_NO_NM:
        ui->statusBar->showMessage(tr("Network Manager was not detected"));
        break;

    case QWifiManager::ERROR_NO_WIFI:
        ui->statusBar->showMessage(tr("No Wifi device detected"));
        break;

    case QWifiManager::ERROR_NO_WIFI_ENABLED:
        ui->statusBar->showMessage(tr("The wifi device is not enabled"));
        break;
    }

}
void RouterKeygen::refreshNetworks() {
    enableUI(false);
    setLoadingAnimation(tr("Scanning the network"));
    wifiManager->startScan();
}
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();
}