1
0
mirror of https://github.com/binary-kitchen/doorlockd synced 2024-12-22 10:24: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.cpp
client/qrwidget.h client/qrwidget.h
client/doorlock-client.cpp client/doorlock-client.cpp
client/mainwindow.h) client/mainwindow.h
client/mainwindow.cpp
client/mainwindow.ui)
add_library(doorlock STATIC ${LIBDOORLOCK_SRCS}) add_library(doorlock STATIC ${LIBDOORLOCK_SRCS})
target_link_libraries(doorlock jsoncpp ldap ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) 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}) add_executable(doorlock-client ${DOORLOCK_CLIENT_SRCS})
target_link_libraries(doorlock-client doorlock qrencode Qt5::Widgets) 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 doorlockd DESTINATION sbin/)
install(TARGETS doorlock-client DESTINATION bin/) 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 #ifndef MAINWINDOW_H
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QApplication> #include <QWidget>
#include <QHBoxLayout>
#include <QMainWindow>
#include <QStatusBar>
#include "qrwidget.h" namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow class MainWindow : public QWidget
{ {
Q_OBJECT
public: public:
MainWindow() : explicit MainWindow(QWidget *parent = 0);
QMainWindow() ~MainWindow();
{
layout = new QHBoxLayout;
_qrWidget = new QRWidget; void setQRCode(const std::string &token);
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);
}
private: private:
Ui::MainWindow *ui;
QHBoxLayout* layout = { nullptr };
QRWidget* _qrWidget = { nullptr };
}; };
#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>