mirror of
https://github.com/Quill-OS/quill.git
synced 2024-11-01 05:43:21 -07:00
Working on libraryWidget
This commit is contained in:
parent
3cdce7d0d1
commit
fa1e05af99
4 changed files with 148 additions and 7 deletions
|
@ -1,14 +1,58 @@
|
||||||
#include "librarywidget.h"
|
#include "librarywidget.h"
|
||||||
#include "ui_librarywidget.h"
|
#include "ui_librarywidget.h"
|
||||||
|
#include "functions.h"
|
||||||
|
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
libraryWidget::libraryWidget(QWidget *parent) :
|
libraryWidget::libraryWidget(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::libraryWidget)
|
ui(new Ui::libraryWidget)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->book1Btn->setText("");
|
||||||
|
ui->book2Btn->setText("");
|
||||||
|
ui->book3Btn->setText("");
|
||||||
|
ui->book4Btn->setText("");
|
||||||
|
|
||||||
|
global::toast::modalToast = true;
|
||||||
|
global::toast::indefiniteToast = true;
|
||||||
|
showToast("Sync in progress");
|
||||||
|
|
||||||
|
string_writeconfig("/opt/ibxd", "gutenberg_sync\n");
|
||||||
|
QTimer * syncCheckTimer = new QTimer(this);
|
||||||
|
syncCheckTimer->setInterval(100);
|
||||||
|
connect(syncCheckTimer, &QTimer::timeout, [&]() {
|
||||||
|
if(QFile::exists("/inkbox/gutenbergSyncDone") == true) {
|
||||||
|
if(checkconfig("/inkbox/gutenbergSyncDone") == true) {
|
||||||
|
qDebug() << "Gutenberg sync successfully completed";
|
||||||
|
toastWindow->close();
|
||||||
|
setupView();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qDebug() << "Gutenberg sync encountered an error";
|
||||||
|
toastWindow->close();
|
||||||
|
showToast("Error");
|
||||||
|
libraryWidget::close();
|
||||||
|
}
|
||||||
|
QFile::remove("/inkbox/gutenbergSyncDone");
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
syncCheckTimer->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
libraryWidget::~libraryWidget()
|
libraryWidget::~libraryWidget()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void libraryWidget::setupView() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void libraryWidget::showToast(QString messageToDisplay) {
|
||||||
|
global::toast::message = messageToDisplay;
|
||||||
|
toastWindow = new toast(this);
|
||||||
|
toastWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
toastWindow->show();
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define LIBRARYWIDGET_H
|
#define LIBRARYWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <toast.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class libraryWidget;
|
class libraryWidget;
|
||||||
|
@ -17,6 +18,12 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::libraryWidget * ui;
|
Ui::libraryWidget * ui;
|
||||||
|
toast * toastWindow;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void setupView();
|
||||||
|
void showToast(QString messageToDisplay);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LIBRARYWIDGET_H
|
#endif // LIBRARYWIDGET_H
|
||||||
|
|
101
librarywidget.ui
101
librarywidget.ui
|
@ -1,21 +1,110 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<author/>
|
|
||||||
<comment/>
|
|
||||||
<exportmacro/>
|
|
||||||
<class>libraryWidget</class>
|
<class>libraryWidget</class>
|
||||||
<widget class="QWidget" name="libraryWidget">
|
<widget class="QWidget" name="libraryWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>526</width>
|
||||||
<height>300</height>
|
<height>419</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="book1Btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book 1</string>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<pixmapfunction/>
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="book3Btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book 3</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QPushButton" name="book2Btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book 2</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="3">
|
||||||
|
<widget class="QPushButton" name="book4Btn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book 4</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="book1Label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book 1</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="book2Label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book 2</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="book3Label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book 3</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3">
|
||||||
|
<widget class="QLabel" name="book4Label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Book 4</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -1047,6 +1047,7 @@ void MainWindow::on_libraryButton_clicked()
|
||||||
|
|
||||||
// Create widget
|
// Create widget
|
||||||
libraryWidgetWindow = new libraryWidget();
|
libraryWidgetWindow = new libraryWidget();
|
||||||
|
libraryWidgetWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui->stackedWidget->insertWidget(3, libraryWidgetWindow);
|
ui->stackedWidget->insertWidget(3, libraryWidgetWindow);
|
||||||
global::mainwindow::tabSwitcher::libraryWidgetCreated = true;
|
global::mainwindow::tabSwitcher::libraryWidgetCreated = true;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue