Skip to content

Commit

Permalink
Add some UI elements
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulh committed Oct 27, 2015
1 parent af14a6b commit 271ffa1
Show file tree
Hide file tree
Showing 32 changed files with 2,690 additions and 16 deletions.
9 changes: 9 additions & 0 deletions gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ TARGET = MoolticuteApp

CONFIG += c++11

include(src/QtAwesome/QtAwesome.pri)

SOURCES += src/main_gui.cpp \
src/MainWindow.cpp \
src/Common.cpp \
Expand All @@ -17,3 +19,10 @@ HEADERS += src/MainWindow.h \
src/WSClient.h

FORMS += src/MainWindow.ui

RESOURCES += \
img/images.qrc

win32 {
RC_FILE = win/windows_res.rc
}
Binary file added img/AppIcon_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/AppIcon_19.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/AppIcon_32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/Plain_128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions img/images.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<RCC>
<qresource prefix="/">
<file>AppIcon_19.png</file>
<file>AppIcon_32.png</file>
<file>AppIcon_128.png</file>
<file>images.qrc</file>
<file>integrity-check.png</file>
<file>management-mode.png</file>
<file>message_alert.png</file>
<file>message_error.png</file>
<file>message_success.png</file>
<file>mp-logo.png</file>
<file>new-card.png</file>
<file>no-card.png</file>
<file>no-connection.png</file>
<file>noun_18878_cc.png</file>
<file>Plain_128.png</file>
<file>unlock.png</file>
</qresource>
</RCC>
Binary file added img/integrity-check.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/management-mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/message_alert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/message_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/message_success.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/mp-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/new-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/no-card.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/no-connection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/noun_18878_cc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/unlock.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions mac/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleIconFile</key>
<string>icon.icns</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>MoolticuteApp</string>
<key>CFBundleIdentifier</key>
<string>org.raoulh.moolticute</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>
20 changes: 20 additions & 0 deletions mac/create_dmg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

if [ $# -ne 1 ]
then
echo "Usage: $0 <version>"
exit 1
fi

VERSION=$1

echo "Copy files..."
cp Info.plist ../../build/Moolticute.app/Contents/
cp icon.icns ../../build/Moolticute.app/Contents/Resources/

echo "Creating dmg package..."
macdeployqt ../../build/Moolticute.app -dmg
mv ../../build/calaos_installer.dmg ../../Moolticute_macosx_$VERSION.dmg

echo "Done."
echo "Package: ../../Moolticute_macosx_$VERSION.dmg"
62 changes: 51 additions & 11 deletions src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,67 @@
#include "MainWindow.h"
#include "ui_MainWindow.h"

#define CSS_BLUE_BUTTON "QPushButton {" \
"color: #fff;" \
"background-color: #60B1C7;" \
"padding: 15px;" \
"border: none;" \
"}" \
"QPushButton:hover {" \
"background-color: #3d96af;" \
"}"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
awesome = new QtAwesome(this);
awesome->initFontAwesome();

ui->setupUi(this);

ui->pushButtonDevSettings->setIcon(awesome->icon(fa::wrench));
ui->pushButtonCred->setIcon(awesome->icon(fa::key));
ui->pushButtonSync->setIcon(awesome->icon(fa::refresh));

ui->labelLogo->setPixmap(QPixmap(":/mp-logo.png").scaled(500, ui->widgetHeader->sizeHint().height() - 8, Qt::KeepAspectRatio));

wsClient = new WSClient(this);
connect(wsClient, &WSClient::connectedChanged, [=]()
{
if (wsClient->get_connected())
ui->plainTextEdit->appendPlainText("Mooltipass connected");
else
ui->plainTextEdit->appendPlainText("Mooltipass disconnected");
});
connect(wsClient, &WSClient::statusChanged, [=]()
{
ui->plainTextEdit->appendPlainText(QString("Status: %1").arg(Common::MPStatusString[wsClient->get_status()]));
});
// connect(wsClient, &WSClient::connectedChanged, [=]()
// {
// if (wsClient->get_connected())
// ui->plainTextEdit->appendPlainText("Mooltipass connected");
// else
// ui->plainTextEdit->appendPlainText("Mooltipass disconnected");
// });
// connect(wsClient, &WSClient::statusChanged, [=]()
// {
// ui->plainTextEdit->appendPlainText(QString("Status: %1").arg(Common::MPStatusString[wsClient->get_status()]));
// });

ui->pushButtonMemMode->setStyleSheet(CSS_BLUE_BUTTON);
ui->pushButtonExportFile->setStyleSheet(CSS_BLUE_BUTTON);
ui->pushButtonImportFile->setStyleSheet(CSS_BLUE_BUTTON);

connect(ui->pushButtonDevSettings, SIGNAL(clicked(bool)), this, SLOT(updatedPage()));
connect(ui->pushButtonCred, SIGNAL(clicked(bool)), this, SLOT(updatedPage()));
connect(ui->pushButtonSync, SIGNAL(clicked(bool)), this, SLOT(updatedPage()));

ui->pushButtonDevSettings->setChecked(true);
ui->stackedWidget->setCurrentIndex(0);
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::updatedPage()
{
if (ui->pushButtonDevSettings->isChecked())
ui->stackedWidget->setCurrentIndex(0);
else if (ui->pushButtonCred->isChecked())
ui->stackedWidget->setCurrentIndex(1);
else if (ui->pushButtonSync->isChecked())
ui->stackedWidget->setCurrentIndex(2);
}
5 changes: 5 additions & 0 deletions src/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include <QtWidgets>
#include "WSClient.h"
#include <QtAwesome.h>

namespace Ui {
class MainWindow;
Expand All @@ -35,11 +36,15 @@ class MainWindow : public QMainWindow
~MainWindow();

private slots:
void updatedPage();


// void mpAdded(MPDevice *device);
// void mpRemoved(MPDevice *);

private:
Ui::MainWindow *ui;
QtAwesome* awesome;

WSClient *wsClient;
};
Expand Down
Loading

0 comments on commit 271ffa1

Please sign in to comment.