Skip to content

Commit

Permalink
Add About widget and corresponding menubar action openwall#39
Browse files Browse the repository at this point in the history
  • Loading branch information
mathsoft-dev committed Jul 14, 2015
1 parent ebbdc9c commit 0c0c2dd
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 5 deletions.
143 changes: 143 additions & 0 deletions forms/aboutwidget.ui
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>aboutWidget</class>
<widget class="QWidget" name="aboutWidget">
<property name="windowModality">
<enum>Qt::NonModal</enum>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>437</width>
<height>427</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>6</number>
</property>
<item alignment="Qt::AlignHCenter">
<widget class="QLabel" name="johnnyLogo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../resources/resources.qrc">:/icons/johnny.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Johnny</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="versionLabel">
<property name="text">
<string>version </string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QPushButton" name="checkUpdateButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Check for update</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>© 2012-2015 john-devs. All rights reserved.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>This software is released under the LGPL license.
Built with the help of the following 3rd party components:</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>* Qt SDK from http://www.qt.io/download-open-source/ - LGPL; Multi license
* Icons by &quot;Open Iconic www.useiconic.com/open&quot; - MIT License</string>
</property>
<property name="textFormat">
<enum>Qt::AutoText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>6</number>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../resources/resources.qrc"/>
</resources>
<connections/>
</ui>
22 changes: 20 additions & 2 deletions forms/mainwindow.ui
Expand Up @@ -940,8 +940,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>756</width>
<height>504</height>
<width>446</width>
<height>220</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
Expand Down Expand Up @@ -1151,9 +1151,17 @@
</property>
<addaction name="actionCopyToClipboard"/>
</widget>
<widget class="QMenu" name="menu">
<property name="title">
<string>?</string>
</property>
<addaction name="actionCheckForUpdates"/>
<addaction name="actionAboutJohnny"/>
</widget>
<addaction name="menuFile"/>
<addaction name="menuAttack"/>
<addaction name="menuPasswords"/>
<addaction name="menu"/>
</widget>
<widget class="QToolBar" name="tabSelectionToolBar">
<property name="sizePolicy">
Expand Down Expand Up @@ -1441,6 +1449,16 @@
<string>Ctrl+5</string>
</property>
</action>
<action name="actionAboutJohnny">
<property name="text">
<string>About Johnny</string>
</property>
</action>
<action name="actionCheckForUpdates">
<property name="text">
<string>Check for updates</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
Expand Down
9 changes: 8 additions & 1 deletion johnny.pro
Expand Up @@ -9,6 +9,12 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = johnny

# The application version
VERSION = 2.0

# Define the preprocessor macro to get the application version in our application.
DEFINES += APP_VERSION=\\\"$$VERSION\\\"

TEMPLATE = app

SOURCES += src/main.cpp\
Expand Down Expand Up @@ -36,7 +42,8 @@ HEADERS += src/mainwindow.h \

INCLUDEPATH += src/

FORMS += forms/mainwindow.ui
FORMS += forms/mainwindow.ui \
forms/aboutwidget.ui

TRANSLATIONS = translations/johnny_fr.ts
CODECFORTR = UTF-8
Expand Down
3 changes: 3 additions & 0 deletions src/main.cpp
Expand Up @@ -28,6 +28,9 @@ int main(int argc, char *argv[])

QApplication app(argc, argv);

// Setting the application version which is defined in johnny.pro
app.setApplicationVersion(APP_VERSION);

QSettings settings(QDir(QDir::home().filePath(".john")).filePath("johnny.conf"),
QSettings::IniFormat);
QString settingLanguage = settings.value("Language").toString();
Expand Down
17 changes: 15 additions & 2 deletions src/mainwindow.cpp
Expand Up @@ -8,6 +8,7 @@
#include "ui_mainwindow.h"
#include "translator.h"
#include "filetablemodel.h"
#include "ui_aboutwidget.h"

#include <QToolButton>
#include <QStringListModel>
Expand All @@ -22,6 +23,7 @@
#include <QDesktopServices>
#include <QInputDialog>
#include <QtDebug>
#include <QDesktopWidget>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
Expand All @@ -40,7 +42,8 @@ MainWindow::MainWindow(QSettings &settings)
m_ui(new Ui::MainWindow),
m_hashesTable(NULL),
m_johnShowTemp(NULL),
m_settings(settings)
m_settings(settings),
m_aboutWindow(this)
{
// UI initializations
m_ui->setupUi(this);
Expand Down Expand Up @@ -189,7 +192,12 @@ MainWindow::MainWindow(QSettings &settings)
//As of now, fork is only supported on unix platforms
m_ui->widgetFork->hide();
#endif

m_aboutWindow.setWindowFlags(Qt::Window | Qt::WindowStaysOnTopHint | Qt::WindowCloseButtonHint);
Ui::aboutWidget aboutUi;
aboutUi.setupUi(&m_aboutWindow);
aboutUi.versionLabel->setText(tr("version ") + QCoreApplication::applicationVersion());
connect(m_ui->actionAboutJohnny, SIGNAL(triggered()), &m_aboutWindow, SLOT(show()));
connect(aboutUi.checkUpdateButton, SIGNAL(clicked()), this, SLOT(checkForUpdates()));
}

void MainWindow::closeEvent(QCloseEvent *event)
Expand Down Expand Up @@ -1340,3 +1348,8 @@ void MainWindow::restoreDefaultAttackOptions(bool shouldClearFields)
m_ui->attackModeTabWidget->setCurrentWidget(m_ui->defaultModeTab);
m_ui->spinBox_nbOfOpenMPThread->setValue(0); // 0 means special value = default
}

void MainWindow::checkForUpdates()
{
QDesktopServices::openUrl(QUrl("http://openwall.info/wiki/john/johnny"));
}
2 changes: 2 additions & 0 deletions src/mainwindow.h
Expand Up @@ -55,6 +55,7 @@ private slots:
void updateStatistics();
void restoreSessionOptions();
void restoreDefaultAttackOptions(bool shouldClearFields = true);
void checkForUpdates();

// JtR backend
void updateJohnOutput();
Expand Down Expand Up @@ -136,6 +137,7 @@ private slots:
#ifdef Q_OS_OSX
QLabel *m_progressStatsLabel;
#endif
QWidget m_aboutWindow;
};

#endif // MAINWINDOW_H

0 comments on commit 0c0c2dd

Please sign in to comment.