Skip to content

Commit

Permalink
fix refreshing by adding delays
Browse files Browse the repository at this point in the history
  • Loading branch information
Szybet committed Oct 14, 2023
1 parent e21a42e commit 6bdbfdf
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
14 changes: 12 additions & 2 deletions cardView/buttons/fourOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "global.h"
#include "ui_fourOptions.h"

#include <QTimer>

fourOptions::fourOptions(QWidget *parent) :
QWidget(parent),
ui(new Ui::fourOptions)
Expand Down Expand Up @@ -53,10 +55,18 @@ void fourOptions::on_showButton_clicked()
emit show();
}

#define BUTTON_DELAY 650

void fourOptions::showButtons() {
ui->stackedWidget->setCurrentIndex(0);
QTimer::singleShot(BUTTON_DELAY, this, [this]() {
QApplication::processEvents();
ui->stackedWidget->setCurrentIndex(0);
});
}

void fourOptions::hideButtons() {
ui->stackedWidget->setCurrentIndex(1);
QTimer::singleShot(BUTTON_DELAY, this, [this]() {
QApplication::processEvents();
ui->stackedWidget->setCurrentIndex(1);
});
}
18 changes: 10 additions & 8 deletions cardView/deckPlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,16 @@ void DeckPlay::setText(QTextBrowser* area, QString text) {
previousFrontText = text;
}

int finalWidth = area->width();
if(zoomFactor == 1.0) {
finalWidth = finalWidth - 50;
} else {
finalWidth = finalWidth * zoomFactor;
}
if(text.contains("<img") == true) {
int finalWidth = area->width();
if(zoomFactor == 1.0) {
finalWidth = finalWidth - 50;
} else {
finalWidth = finalWidth * zoomFactor;
}

text = adjustImgSize(finalWidth, text);
text = adjustImgSize(finalWidth, text);
}

area->setHtml(text);

Expand Down Expand Up @@ -276,7 +278,7 @@ void DeckPlay::setText(QTextBrowser* area, QString text) {
// Trying to fix some ghosting when in A2
WaveForm currentWaveFormConverted = static_cast<WaveForm>(currentWaveForm);
if(currentWaveFormConverted == WaveForm_A2) {
qDebug() << "Trying to fix ghosting";
qDebug() << "Check if ghost fix is needed";
if(text.count() > 50) {
QTimer::singleShot(500, this, [this, area, text]() {
if(area->horizontalScrollBar()->isVisible() || area->verticalScrollBar()->isVisible()) {
Expand Down
2 changes: 1 addition & 1 deletion cardView/deckPlay.ui
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
<x>0</x>
<y>0</y>
<width>710</width>
<height>517</height>
<height>518</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down
7 changes: 5 additions & 2 deletions cardView/modes/boxes/boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#include <QObject>
#include <QDebug>

#define SMALL_STATS_UPDATE_DELAY 2000

boxes::boxes(QObject *parent)
: QObject{parent}
{
Expand Down Expand Up @@ -138,7 +141,7 @@ void boxes::loop() {

// Before changing anything
int whichBoxTmp = whichBox;
QTimer::singleShot(300, this, [this, whichBoxTmp]() {
QTimer::singleShot(SMALL_STATS_UPDATE_DELAY, this, [this, whichBoxTmp]() {
cardStatUpdate(whichBoxTmp, 0);
});
}
Expand Down Expand Up @@ -174,7 +177,7 @@ void boxes::moveCard(int moveValue) {

// Before changing anything
int whichBoxTmp = whichBox;
QTimer::singleShot(300, this, [this, whichBoxTmp, moveValue]() {
QTimer::singleShot(SMALL_STATS_UPDATE_DELAY, this, [this, whichBoxTmp, moveValue]() {
cardStatUpdate(whichBoxTmp, moveValue);
});

Expand Down
4 changes: 2 additions & 2 deletions inkbox_userapp/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ sshpass -p $passwd ssh $servername "bash -c \"sync\""
sshpass -p $passwd ssh $servername "bash -c \"killall -9 sanki-debug.sh\"" || EXIT_CODE=0
sshpass -p $passwd ssh $servername "bash -c \"killall -9 sanki.sh\"" || EXIT_CODE=0

sshpass -p $passwd ssh $servername "bash -c \"rc-service inkbox_gui restart\"" # to get logs
# sshpass -p $passwd ssh $servername "bash -c \"rc-service gui_apps restart\""
# sshpass -p $passwd ssh $servername "bash -c \"rc-service inkbox_gui restart\"" # to get logs
sshpass -p $passwd ssh $servername "bash -c \"rc-service gui_apps restart\""

# To update main json
# sshpass -p $passwd ssh $servername "bash -c \"touch /kobo/tmp/rescan_userapps\"" # This gets deleted by service restart
Expand Down

0 comments on commit 6bdbfdf

Please sign in to comment.