mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 07:37:21 -08:00
Create new libraryWidget class and associate it with libraryButton
This commit is contained in:
parent
591ecfe72f
commit
3cdce7d0d1
10 changed files with 129 additions and 15 deletions
1
eink.qrc
1
eink.qrc
|
@ -69,5 +69,6 @@
|
|||
<file>resources/error.png</file>
|
||||
<file>resources/alert-triangle.png</file>
|
||||
<file>resources/online-library.png</file>
|
||||
<file>resources/online-library-inverted.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -46,6 +46,8 @@ namespace global {
|
|||
inline bool appsWidgetSelected;
|
||||
inline bool settingsChooserWidgetCreated;
|
||||
inline bool settingsChooserWidgetSelected;
|
||||
inline bool libraryWidgetCreated;
|
||||
inline bool libraryWidgetSelected;
|
||||
}
|
||||
inline bool updateDialog;
|
||||
inline bool lowBatteryDialog;
|
||||
|
|
|
@ -21,6 +21,7 @@ SOURCES += \
|
|||
hourglassanimationwidget.cpp \
|
||||
koboxappsdialog.cpp \
|
||||
koboxsettings.cpp \
|
||||
librarywidget.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
otamanager.cpp \
|
||||
|
@ -49,6 +50,7 @@ HEADERS += \
|
|||
hourglassanimationwidget.h \
|
||||
koboxappsdialog.h \
|
||||
koboxsettings.h \
|
||||
librarywidget.h \
|
||||
mainwindow.h \
|
||||
otamanager.h \
|
||||
quit.h \
|
||||
|
@ -75,6 +77,7 @@ FORMS += \
|
|||
hourglassanimationwidget.ui \
|
||||
koboxappsdialog.ui \
|
||||
koboxsettings.ui \
|
||||
librarywidget.ui \
|
||||
mainwindow.ui \
|
||||
otamanager.ui \
|
||||
quit.ui \
|
||||
|
|
14
librarywidget.cpp
Normal file
14
librarywidget.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "librarywidget.h"
|
||||
#include "ui_librarywidget.h"
|
||||
|
||||
libraryWidget::libraryWidget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::libraryWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
libraryWidget::~libraryWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
22
librarywidget.h
Normal file
22
librarywidget.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef LIBRARYWIDGET_H
|
||||
#define LIBRARYWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class libraryWidget;
|
||||
}
|
||||
|
||||
class libraryWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit libraryWidget(QWidget *parent = nullptr);
|
||||
~libraryWidget();
|
||||
|
||||
private:
|
||||
Ui::libraryWidget *ui;
|
||||
};
|
||||
|
||||
#endif // LIBRARYWIDGET_H
|
21
librarywidget.ui
Normal file
21
librarywidget.ui
Normal file
|
@ -0,0 +1,21 @@
|
|||
<ui version="4.0">
|
||||
<author/>
|
||||
<comment/>
|
||||
<exportmacro/>
|
||||
<class>libraryWidget</class>
|
||||
<widget class="QWidget" name="libraryWidget">
|
||||
<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>
|
||||
</widget>
|
||||
<pixmapfunction/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -720,11 +720,16 @@ void MainWindow::resetWindow(bool resetStackedWidget) {
|
|||
if(global::mainwindow::tabSwitcher::settingsChooserWidgetCreated == true) {
|
||||
settingsChooserWindow->deleteLater();
|
||||
}
|
||||
if(global::mainwindow::tabSwitcher::libraryWidgetCreated == true) {
|
||||
libraryWidgetWindow->deleteLater();
|
||||
}
|
||||
|
||||
global::mainwindow::tabSwitcher::appsWidgetCreated = false;
|
||||
global::mainwindow::tabSwitcher::settingsChooserWidgetCreated = false;
|
||||
global::mainwindow::tabSwitcher::appsWidgetSelected = false;
|
||||
global::mainwindow::tabSwitcher::settingsChooserWidgetSelected = false;
|
||||
global::mainwindow::tabSwitcher::libraryWidgetCreated = false;
|
||||
global::mainwindow::tabSwitcher::libraryWidgetSelected = false;
|
||||
|
||||
resetIcons();
|
||||
setBatteryIcon();
|
||||
|
@ -739,6 +744,8 @@ void MainWindow::resetIcons() {
|
|||
ui->appsBtn->setIcon(QIcon(":/resources/apps.png"));
|
||||
ui->settingsBtn->setStyleSheet("background: white");
|
||||
ui->settingsBtn->setIcon(QIcon(":/resources/settings.png"));
|
||||
ui->libraryButton->setStyleSheet("background: white");
|
||||
ui->libraryButton->setIcon(QIcon(":/resources/online-library.png"));
|
||||
}
|
||||
|
||||
void MainWindow::setBatteryIcon() {
|
||||
|
@ -1030,3 +1037,27 @@ void MainWindow::checkForUpdate() {
|
|||
void MainWindow::openEncfsEncryptDialog() {
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::on_libraryButton_clicked()
|
||||
{
|
||||
resetWindow(false);
|
||||
if(global::mainwindow::tabSwitcher::libraryWidgetSelected != true) {
|
||||
ui->libraryButton->setStyleSheet("background: black; color: white");
|
||||
ui->libraryButton->setIcon(QIcon(":/resources/online-library-inverted.png"));
|
||||
|
||||
// Create widget
|
||||
libraryWidgetWindow = new libraryWidget();
|
||||
ui->stackedWidget->insertWidget(3, libraryWidgetWindow);
|
||||
global::mainwindow::tabSwitcher::libraryWidgetCreated = true;
|
||||
|
||||
// Switch tab
|
||||
ui->stackedWidget->setCurrentIndex(3);
|
||||
global::mainwindow::tabSwitcher::libraryWidgetSelected = true;
|
||||
|
||||
// Repaint
|
||||
this->repaint();
|
||||
}
|
||||
else {
|
||||
;
|
||||
}
|
||||
}
|
||||
|
|
34
mainwindow.h
34
mainwindow.h
|
@ -17,6 +17,7 @@
|
|||
#include "virtualkeypad.h"
|
||||
#include "toast.h"
|
||||
#include "otamanager.h"
|
||||
#include "librarywidget.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -90,22 +91,25 @@ private slots:
|
|||
void checkForUpdate();
|
||||
void openEncfsEncryptDialog();
|
||||
|
||||
void on_libraryButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
settingsChooser *settingsChooserWindow;
|
||||
apps *appsWindow;
|
||||
reader *readerWindow;
|
||||
quit *quitWindow;
|
||||
alert *alertWindow;
|
||||
usbms_splash *usbmsWindow;
|
||||
brightnessDialog *brightnessDialogWindow;
|
||||
generalDialog *generalDialogWindow;
|
||||
koboxSettings *koboxSettingsWindow;
|
||||
koboxAppsDialog *koboxAppsDialogWindow;
|
||||
textwidget *textwidgetWindow;
|
||||
virtualkeypad *keypadWidget;
|
||||
toast *toastWindow;
|
||||
otaManager *otaManagerWindow;
|
||||
Ui::MainWindow * ui;
|
||||
settingsChooser * settingsChooserWindow;
|
||||
apps * appsWindow;
|
||||
reader * readerWindow;
|
||||
quit * quitWindow;
|
||||
alert * alertWindow;
|
||||
usbms_splash * usbmsWindow;
|
||||
brightnessDialog * brightnessDialogWindow;
|
||||
generalDialog * generalDialogWindow;
|
||||
koboxSettings * koboxSettingsWindow;
|
||||
koboxAppsDialog * koboxAppsDialogWindow;
|
||||
textwidget * textwidgetWindow;
|
||||
virtualkeypad * keypadWidget;
|
||||
toast * toastWindow;
|
||||
otaManager * otaManagerWindow;
|
||||
libraryWidget * libraryWidgetWindow;
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
@ -437,6 +437,22 @@
|
|||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_4">
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
|
BIN
resources/online-library-inverted.png
Normal file
BIN
resources/online-library-inverted.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
Loading…
Reference in a new issue