1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 02:14:26 +01:00

Added ui file for MainWindow

This commit is contained in:
Ralf Ramsauer 2015-09-30 15:26:28 +02:00
parent 765e41afd5
commit cde0521d6f
4 changed files with 81 additions and 31 deletions

View File

@ -81,7 +81,9 @@ set(DOORLOCK_CLIENT_SRCS
client/qrwidget.cpp
client/qrwidget.h
client/doorlock-client.cpp
client/mainwindow.h)
client/mainwindow.h
client/mainwindow.cpp
client/mainwindow.ui)
add_library(doorlock STATIC ${LIBDOORLOCK_SRCS})
target_link_libraries(doorlock jsoncpp ldap ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
@ -91,6 +93,7 @@ target_link_libraries(doorlockd doorlock)
add_executable(doorlock-client ${DOORLOCK_CLIENT_SRCS})
target_link_libraries(doorlock-client doorlock qrencode Qt5::Widgets)
target_include_directories(doorlock-client PRIVATE ${CMAKE_SOURCE_DIR})
install(TARGETS doorlockd DESTINATION sbin/)
install(TARGETS doorlock-client DESTINATION bin/)

View File

@ -0,0 +1,19 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::setQRCode(const std::string &token)
{
ui->qrwidget->setQRData(token);
}

View File

@ -1,42 +1,24 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QApplication>
#include <QHBoxLayout>
#include <QMainWindow>
#include <QStatusBar>
#include <QWidget>
#include "qrwidget.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
class MainWindow : public QWidget
{
Q_OBJECT
public:
MainWindow() :
QMainWindow()
{
layout = new QHBoxLayout;
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
_qrWidget = new QRWidget;
layout->addWidget(_qrWidget);
QWidget* window = new QWidget;
window->setLayout(layout);
setCentralWidget(window);
}
MainWindow(const MainWindow&);
MainWindow& operator =(const MainWindow&);
void setQRCode(const std::string &str)
{
_qrWidget->setQRData(str);
}
void setQRCode(const std::string &token);
private:
QHBoxLayout* layout = { nullptr };
QRWidget* _qrWidget = { nullptr };
Ui::MainWindow *ui;
};
#endif
#endif // MAINWINDOW_H

View File

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QWidget" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>886</width>
<height>610</height>
</rect>
</property>
<property name="maximumSize">
<size>
<width>886</width>
<height>610</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRWidget" name="qrwidget" native="true">
<property name="enabled">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QRWidget</class>
<extends>QWidget</extends>
<header>client/qrwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>