mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-25 15:17:21 -08:00
Add QTextBrowser widget and dialog
Some things, such as UIDs, just couldn't display normally and we need such a browser for them. I'll work on implementing as the main engine for the Reader framework.
This commit is contained in:
parent
b91e30d05a
commit
9428483d02
10 changed files with 220 additions and 36 deletions
|
@ -46,6 +46,10 @@ namespace global {
|
|||
namespace settings {
|
||||
inline bool settingsRebootDialog;
|
||||
}
|
||||
namespace text {
|
||||
inline bool textBrowserDialog;
|
||||
inline QString textBrowserContents;
|
||||
}
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/questions/6080853/c-multiple-definition-error-for-global-functions-in-the-header-file/20679534#20679534
|
||||
|
|
|
@ -94,6 +94,13 @@ generalDialog::generalDialog(QWidget *parent) :
|
|||
ui->headerLabel->setText("USB cable connected");
|
||||
this->adjustSize();
|
||||
}
|
||||
else if(global::text::textBrowserDialog == true) {
|
||||
textwidgetWindow = new textwidget();
|
||||
ui->headerLabel->setText("Information");
|
||||
ui->mainStackedWidget->insertWidget(1, textwidgetWindow);
|
||||
ui->mainStackedWidget->setCurrentIndex(1);
|
||||
this->adjustSize();
|
||||
}
|
||||
else {
|
||||
// We shouldn't be there ;)
|
||||
;
|
||||
|
@ -113,14 +120,11 @@ generalDialog::~generalDialog()
|
|||
|
||||
void generalDialog::on_cancelBtn_clicked()
|
||||
{
|
||||
if(resetDialog == true) {
|
||||
generalDialog::close();
|
||||
}
|
||||
if(updateDialog == true) {
|
||||
string_writeconfig("/tmp/cancelUpdateDialog", "true");
|
||||
generalDialog::close();
|
||||
}
|
||||
if(usbmsDialog == true) {
|
||||
else {
|
||||
generalDialog::close();
|
||||
}
|
||||
}
|
||||
|
@ -192,6 +196,10 @@ void generalDialog::on_acceptBtn_clicked()
|
|||
qApp->quit();
|
||||
}
|
||||
}
|
||||
if(textBrowserDialog == true) {
|
||||
global::text::textBrowserContents = "";
|
||||
global::text::textBrowserDialog = false;
|
||||
}
|
||||
|
||||
// We don't have any other option ;p
|
||||
generalDialog::close();
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <QDialog>
|
||||
|
||||
#include "usbms_splash.h"
|
||||
#include "textwidget.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -24,6 +25,7 @@ public:
|
|||
bool koboxSettingsRebootDialog = false;
|
||||
bool lowBatteryDialog = false;
|
||||
bool usbmsDialog = false;
|
||||
bool textBrowserDialog = false;
|
||||
|
||||
private slots:
|
||||
void on_cancelBtn_clicked();
|
||||
|
@ -33,6 +35,7 @@ private slots:
|
|||
private:
|
||||
Ui::generalDialog *ui;
|
||||
usbms_splash *usbmsWindow;
|
||||
textwidget *textwidgetWindow;
|
||||
};
|
||||
|
||||
#endif // GENERALDIALOG_H
|
||||
|
|
133
generaldialog.ui
133
generaldialog.ui
|
@ -16,19 +16,6 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="5" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<property name="bottomMargin">
|
||||
|
@ -53,10 +40,10 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
@ -148,28 +135,110 @@
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="bodyLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Body</string>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QStackedWidget" name="mainStackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_3">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="bodyLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>Inter</family>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Body</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<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>
|
||||
<widget class="QWidget" name="page_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
|
|
@ -25,6 +25,7 @@ SOURCES += \
|
|||
savedwords.cpp \
|
||||
settings.cpp \
|
||||
settingschooser.cpp \
|
||||
textwidget.cpp \
|
||||
usbms_splash.cpp
|
||||
|
||||
HEADERS += \
|
||||
|
@ -42,6 +43,7 @@ HEADERS += \
|
|||
savedwords.h \
|
||||
settings.h \
|
||||
settingschooser.h \
|
||||
textwidget.h \
|
||||
usbms_splash.h
|
||||
|
||||
FORMS += \
|
||||
|
@ -58,6 +60,7 @@ FORMS += \
|
|||
savedwords.ui \
|
||||
settings.ui \
|
||||
settingschooser.ui \
|
||||
textwidget.ui \
|
||||
usbms_splash.ui
|
||||
|
||||
# Default rules for deployment.
|
||||
|
|
|
@ -651,6 +651,13 @@ void MainWindow::on_pushButton_clicked()
|
|||
void MainWindow::on_searchBtn_clicked()
|
||||
{
|
||||
// Hopefully this button will do something one day...
|
||||
/*
|
||||
global::text::textBrowserDialog = true;
|
||||
global::text::textBrowserContents = "Hullo";
|
||||
generalDialogWindow = new generalDialog();
|
||||
generalDialogWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||
generalDialogWindow->show();
|
||||
*/
|
||||
}
|
||||
|
||||
void MainWindow::on_quitBtn_clicked()
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "generaldialog.h"
|
||||
#include "koboxsettings.h"
|
||||
#include "koboxappsdialog.h"
|
||||
#include "textwidget.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -76,5 +77,6 @@ private:
|
|||
generalDialog *generalDialogWindow;
|
||||
koboxSettings *koboxSettingsWindow;
|
||||
koboxAppsDialog *koboxAppsDialogWindow;
|
||||
textwidget *textwidgetWindow;
|
||||
};
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
26
textwidget.cpp
Normal file
26
textwidget.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "textwidget.h"
|
||||
#include "ui_textwidget.h"
|
||||
#include "functions.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QProcess>
|
||||
|
||||
textwidget::textwidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::textwidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// Stylesheet
|
||||
QFile stylesheetFile(":/resources/eink.qss");
|
||||
stylesheetFile.open(QFile::ReadOnly);
|
||||
this->setStyleSheet(stylesheetFile.readAll());
|
||||
stylesheetFile.close();
|
||||
|
||||
ui->textBrowser->setText(global::text::textBrowserContents);
|
||||
}
|
||||
|
||||
textwidget::~textwidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
22
textwidget.h
Normal file
22
textwidget.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef TEXTWIDGET_H
|
||||
#define TEXTWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class textwidget;
|
||||
}
|
||||
|
||||
class textwidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit textwidget(QWidget *parent = nullptr);
|
||||
~textwidget();
|
||||
|
||||
private:
|
||||
Ui::textwidget *ui;
|
||||
};
|
||||
|
||||
#endif // TEXTWIDGET_H
|
40
textwidget.ui
Normal file
40
textwidget.ui
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>textwidget</class>
|
||||
<widget class="QWidget" name="textwidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in a new issue