mirror of
https://github.com/Quill-OS/quill.git
synced 2024-12-26 23:57:22 -08:00
Local library: Segfault bugfixes
This commit is contained in:
parent
6192927b98
commit
2521834d06
3 changed files with 15 additions and 19 deletions
|
@ -49,23 +49,8 @@ localLibraryWidget::localLibraryWidget(QWidget *parent) :
|
||||||
sW = QGuiApplication::screens()[0]->size().width();
|
sW = QGuiApplication::screens()[0]->size().width();
|
||||||
sH = QGuiApplication::screens()[0]->size().height();
|
sH = QGuiApplication::screens()[0]->size().height();
|
||||||
|
|
||||||
// Defining what the default icon size will be
|
stdIconWidth = sW / 9.5;
|
||||||
if(global::deviceID == "n705\n") {
|
stdIconHeight = sH / 9.5;
|
||||||
stdIconWidth = sW / 16;
|
|
||||||
stdIconHeight = sH / 16;
|
|
||||||
}
|
|
||||||
else if(global::deviceID == "n905\n" or global::deviceID == "kt\n") {
|
|
||||||
stdIconWidth = sW / 18;
|
|
||||||
stdIconHeight = sH / 18;
|
|
||||||
}
|
|
||||||
else if(global::deviceID == "n613\n" or global::deviceID == "n236\n" or global::deviceID == "n437\n" or global::deviceID == "n306\n" or global::deviceID == "emu\n") {
|
|
||||||
stdIconWidth = sW / 16.5;
|
|
||||||
stdIconHeight = sH / 16.5;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
stdIconWidth = sW / 18;
|
|
||||||
stdIconHeight = sH / 18;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 1; i <= buttonsNumber; i++) {
|
for(int i = 1; i <= buttonsNumber; i++) {
|
||||||
// Horizontal layout that will contain the book button and its icon
|
// Horizontal layout that will contain the book button and its icon
|
||||||
|
@ -199,7 +184,7 @@ void localLibraryWidget::setupBooksList(int pageNumber) {
|
||||||
in++;
|
in++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(in < buttonsNumber) {
|
if(in <= buttonsNumber) {
|
||||||
for(int i = in; i <= buttonsNumber; i++) {
|
for(int i = in; i <= buttonsNumber; i++) {
|
||||||
bookIconArray[i]->hide();
|
bookIconArray[i]->hide();
|
||||||
bookBtnArray[i]->hide();
|
bookBtnArray[i]->hide();
|
||||||
|
@ -210,7 +195,11 @@ void localLibraryWidget::setupBooksList(int pageNumber) {
|
||||||
}
|
}
|
||||||
ui->pageNumberLabel->setText("Page " + QString::number(pageNumber) + " <i>of</i> " + QString::number(pagesNumber));
|
ui->pageNumberLabel->setText("Page " + QString::number(pageNumber) + " <i>of</i> " + QString::number(pagesNumber));
|
||||||
// NOTICE: Memory leak?
|
// NOTICE: Memory leak?
|
||||||
ui->verticalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
|
// Do it twice, otherwise the layout doesn't show as intended
|
||||||
|
for(int i = 0; i <= 1; i++) {
|
||||||
|
ui->verticalLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
|
||||||
|
}
|
||||||
|
QTimer::singleShot(100, this, SLOT(refreshScreenNative()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void localLibraryWidget::on_previousPageBtn_clicked()
|
void localLibraryWidget::on_previousPageBtn_clicked()
|
||||||
|
@ -246,3 +235,7 @@ void localLibraryWidget::btnOpenBook(int buttonNumber) {
|
||||||
openBook(id);
|
openBook(id);
|
||||||
localLibraryWidget::close();
|
localLibraryWidget::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void localLibraryWidget::refreshScreenNative() {
|
||||||
|
emit refreshScreen();
|
||||||
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ private slots:
|
||||||
void on_nextPageBtn_clicked();
|
void on_nextPageBtn_clicked();
|
||||||
void openBook(int id);
|
void openBook(int id);
|
||||||
void btnOpenBook(int buttonNumber);
|
void btnOpenBook(int buttonNumber);
|
||||||
|
void refreshScreenNative();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::localLibraryWidget * ui;
|
Ui::localLibraryWidget * ui;
|
||||||
|
@ -51,6 +52,7 @@ private:
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openBookSignal(QString bookFile, bool relativePath);
|
void openBookSignal(QString bookFile, bool relativePath);
|
||||||
|
void refreshScreen();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LOCALLIBRARYWIDGET_H
|
#endif // LOCALLIBRARYWIDGET_H
|
||||||
|
|
|
@ -986,6 +986,7 @@ void MainWindow::resetWifiIconClickedWhileReconnecting() {
|
||||||
void MainWindow::setupLocalLibraryWidget() {
|
void MainWindow::setupLocalLibraryWidget() {
|
||||||
localLibraryWidget * localLibraryWidgetWindow = new localLibraryWidget();
|
localLibraryWidget * localLibraryWidgetWindow = new localLibraryWidget();
|
||||||
connect(localLibraryWidgetWindow, SIGNAL(openBookSignal(QString, bool)), SLOT(openBookFile(QString, bool)));
|
connect(localLibraryWidgetWindow, SIGNAL(openBookSignal(QString, bool)), SLOT(openBookFile(QString, bool)));
|
||||||
|
connect(localLibraryWidgetWindow, SIGNAL(refreshScreen()), SLOT(refreshScreen()));
|
||||||
localLibraryWidgetWindow->setAttribute(Qt::WA_DeleteOnClose);
|
localLibraryWidgetWindow->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ui->homeStackedWidget->insertWidget(1, localLibraryWidgetWindow);
|
ui->homeStackedWidget->insertWidget(1, localLibraryWidgetWindow);
|
||||||
ui->homeStackedWidget->setCurrentIndex(1);
|
ui->homeStackedWidget->setCurrentIndex(1);
|
||||||
|
|
Loading…
Reference in a new issue