Skip to content

Commit

Permalink
Set the Build configuration of the Windows build to Release mode. Cre…
Browse files Browse the repository at this point in the history
…ate the tray icon without trigeering a scan result.
  • Loading branch information
ruiaraujo committed Aug 30, 2013
1 parent 83bbbad commit a5d66b3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build_win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BUILD_FOLDER=$ROOT_FOLDER/win
mkdir -p $BUILD_FOLDER
cd $BUILD_FOLDER

cmake -DCMAKE_TOOLCHAIN_FILE=$MXE_ROOT/usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake -DQT_LUPDATE_EXECUTABLE=lupdate -DQT_LRELEASE_EXECUTABLE=lrelease -DOPENSSL_ROOT_DIR=$MXE_ROOT/usr/i686-pc-mingw32 -DCMAKE_CROSS_COMPILING=TRUE $SRC_FOLDER
cmake -DCMAKE_TOOLCHAIN_FILE=$MXE_ROOT/usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake -DQT_LUPDATE_EXECUTABLE=lupdate -DQT_LRELEASE_EXECUTABLE=lrelease -DOPENSSL_ROOT_DIR=$MXE_ROOT/usr/i686-pc-mingw32 -DCMAKE_CROSS_COMPILING=TRUE -DCMAKE_BUILD_TYPE=Release $SRC_FOLDER
if [ "$?" = "0" ]; then
make
else
Expand Down
31 changes: 22 additions & 9 deletions src/RouterKeygen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

RouterKeygen::RouterKeygen(QWidget *parent) :
QMainWindow(parent), ui(new Ui::RouterKeygen), manualWifi(NULL),matcher(new WirelessMatcher()),
calculator(NULL), loading(NULL), loadingText(NULL), aboutDialog(NULL), welcomeDialog(NULL), automaticUpdateCheck(true) {
calculator(NULL), loading(NULL), loadingText(NULL), aboutDialog(NULL), welcomeDialog(NULL){
ui->setupUi(this);
#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC)
setWindowIcon(QIcon(":/big_icon.png"));
Expand Down Expand Up @@ -137,8 +137,24 @@ RouterKeygen::RouterKeygen(QWidget *parent) :
connect(runInBackgroundAction, SIGNAL(toggled(bool)), this,
SLOT(backgroundRunToggle(bool)));

scanFinished(QWifiManager::SCAN_OK);
//Set up the tray icon
connect(trayMenu->addAction(tr("Open")),
SIGNAL(triggered()), this, SLOT(show()));
trayMenu->addSeparator();
connect(trayMenu->addAction(tr("Vulnerable networks")),
SIGNAL(triggered()), this, SLOT(show()));
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()));

//Do an initial scan
wifiManager->startScan();

//Check for application updates, it fails silently
automaticUpdateCheck = true;
checkUpdates();
}

Expand Down Expand Up @@ -192,7 +208,9 @@ void RouterKeygen::onNetworkReply(QNetworkReply* reply){
sc = engine.evaluate("(" +QString(result) + ")");
QString version = sc.property("version").toString();
if ( version == QApplication::applicationVersion() ){
ui->statusBar->showMessage(tr("The application is already at the latest version."));
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()
Expand Down Expand Up @@ -399,8 +417,7 @@ void RouterKeygen::scanFinished(int code) {
trayMenu->addAction(startUpAction);
trayMenu->addAction(runInBackgroundAction);
trayMenu->addSeparator();
QAction * exitAction = trayMenu->addAction(tr("Quit"));
connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(trayMenu->addAction(tr("Quit")), SIGNAL(triggered()), qApp, SLOT(quit()));
if (wifiNetworks.size() == 0) {
ui->statusBar->showMessage(tr("None were detected"));
}
Expand Down Expand Up @@ -440,8 +457,6 @@ void RouterKeygen::scanFinished(int code) {

void RouterKeygen::addNetworkToTray(const QString & ssid, int level, bool locked ) {
QIcon icon;
#ifdef Q_OS_UNIX
#ifndef Q_OS_MAC
if (level >= 75)
icon = locked?QIcon::fromTheme("nm-signal-100-secure"):QIcon::fromTheme("nm-signal-100");
else if (level >= 50)
Expand All @@ -450,8 +465,6 @@ void RouterKeygen::addNetworkToTray(const QString & ssid, int level, bool locked
icon = locked?QIcon::fromTheme("nm-signal-50-secure"):QIcon::fromTheme("nm-signal-50");
else
icon = locked?QIcon::fromTheme("nm-signal-25-secure"):QIcon::fromTheme("nm-signal-25");
#endif
#endif
QAction * net = trayMenu->addAction(icon, ssid);
connect(net, SIGNAL(triggered()), this, SLOT(show()));
}
Expand Down

0 comments on commit a5d66b3

Please sign in to comment.