Skip to content

Commit

Permalink
fix renderer issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Szybet committed Oct 17, 2023
1 parent 13ec8f6 commit e3f6221
Show file tree
Hide file tree
Showing 17 changed files with 45 additions and 23 deletions.
1 change: 1 addition & 0 deletions cardView/buttons/fourOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ fourOptions::fourOptions(QWidget *parent) :
ui(new Ui::fourOptions)
{
ui->setupUi(this);
this->setAttribute(Qt::WA_DeleteOnClose);
if(ereader) {
ui->againButton->setStyleSheet(ereaderVars::buttonNoFlashStylesheet);
ui->hardButton->setStyleSheet(ereaderVars::buttonNoFlashStylesheet);
Expand Down
1 change: 1 addition & 0 deletions cardView/buttons/fourOptionsNFlashy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fourOptionsNFlashy::fourOptionsNFlashy(QWidget *parent) :
ui(new Ui::fourOptionsNFlashy)
{
ui->setupUi(this);
this->setAttribute(Qt::WA_DeleteOnClose);
if(ereader) {
ui->againButton->setStyleSheet(ereaderVars::buttonNoFlashStylesheet);
ui->hardButton->setStyleSheet(ereaderVars::buttonNoFlashStylesheet);
Expand Down
1 change: 1 addition & 0 deletions cardView/buttons/showCard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ showCard::showCard(QWidget *parent) :
ui(new Ui::showCard)
{
ui->setupUi(this);
this->setAttribute(Qt::WA_DeleteOnClose);
if(ereader) {
ui->pushButton->setStyleSheet(ereaderVars::buttonNoFlashStylesheet);
this->setFixedHeight(125);
Expand Down
14 changes: 8 additions & 6 deletions cardView/deckPlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void DeckPlay::setText(QTextBrowser* area, QString text) {
WaveForm currentWaveFormConverted = static_cast<WaveForm>(currentWaveForm);
if(currentWaveFormConverted == WaveForm_A2) {
qDebug() << "Check if ghost fix is needed";
if(text.count() > 50 == true || text.contains("<img") == true || area->horizontalScrollBar()->isVisible() == true || area->verticalScrollBar()->isVisible() == true) {
if(text.count() > 200 == true || text.contains("<img") == true || area->horizontalScrollBar()->isVisible() == true || area->verticalScrollBar()->isVisible() == true) {
QTimer::singleShot(500, this, [this, area, text]() {
qDebug() << "Requesting special refresh for ghosting";
QApplication::processEvents();
Expand Down Expand Up @@ -517,11 +517,13 @@ bool DeckPlay::event(QEvent *event)
}
} else if(QGesture* gesture = gEvent->gesture(Qt::TapAndHoldGesture)) {
Q_UNUSED(gesture);
qDebug() << "TapAndHoldGesture gesture";
int elapsed = gestureTimer->elapsed();
if(gestureTimer->isValid() == true && elapsed > 700) {
gestureTimer->restart();
refreshCard(true);
if(grender == false) { // doesn't work at all
qDebug() << "TapAndHoldGesture gesture";
int elapsed = gestureTimer->elapsed();
if(gestureTimer->isValid() == true && elapsed > 700) {
gestureTimer->restart();
refreshCard(true);
}
}
} else if(QGesture* gesture = gEvent->gesture(Qt::TapGesture)) {
Q_UNUSED(gesture);
Expand Down
4 changes: 2 additions & 2 deletions cardView/modes/boxes/boxes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ void boxes::setup(DeckPlay* parentArg, Ui::DeckPlay* parentUiArg) {
backText = parentUi->textBackCard;

if(parent->enabledTapGesture == false) {
fourOptions* buttons = new fourOptions(parent);
fourOptions* buttons = new fourOptions();
connect(buttons, &fourOptions::again, this, &boxes::againClicked);
connect(buttons, &fourOptions::hard, this, &boxes::hardClicked);
connect(buttons, &fourOptions::good, this, &boxes::goodClicked);
connect(buttons, &fourOptions::easy, this, &boxes::easyClicked);
connect(buttons, &fourOptions::show, this, &boxes::showBack);
parentUi->gridManageCard->addWidget(buttons);
} else {
fourOptionsNFlashy* buttons = new fourOptionsNFlashy(parent);
fourOptionsNFlashy* buttons = new fourOptionsNFlashy();
connect(buttons, &fourOptionsNFlashy::again, this, &boxes::againClicked);
connect(buttons, &fourOptionsNFlashy::hard, this, &boxes::hardClicked);
connect(buttons, &fourOptionsNFlashy::good, this, &boxes::goodClicked);
Expand Down
2 changes: 1 addition & 1 deletion cardView/modes/completlyRandom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ void CompletlyRandom::setup(DeckPlay* parentArg, Ui::DeckPlay* parentUiArg) {
backText = parentUi->textBackCard;

// Setup show/next card button
showCard* showCardWidget = new showCard(parentArg);
showCard* showCardWidget = new showCard();

connect(showCardWidget, &showCard::clicked, this, &CompletlyRandom::buttonClicked); // Button slot
connect(this, &CompletlyRandom::setText, showCardWidget, &showCard::setText);
Expand Down
2 changes: 1 addition & 1 deletion cardView/modes/randomNoRepeat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void randomNoRepeat::setup(DeckPlay* parentArg, Ui::DeckPlay* parentUiArg, QSqlD
db = dbArg;

// Setup show/next card button
showCard* showCardWidget = new showCard(parentArg);
showCard* showCardWidget = new showCard();

connect(showCardWidget, &showCard::clicked, this, &randomNoRepeat::buttonClicked); // Button slot
connect(this, &randomNoRepeat::setText, showCardWidget, &showCard::setText);
Expand Down
4 changes: 2 additions & 2 deletions components/files/fileChooser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void fileChooserCustom::updateFiles()
continue;
}

file* fileButton = new file(this);
file* fileButton = new file();
QIcon icon;
if(fileInfo.isDir() == true) {
icon = QIcon(":/icons/folder.svg");
Expand Down Expand Up @@ -148,7 +148,7 @@ void fileChooserCustom::manageKeyboards() {
if(textEditToCheck->underMouse() == true && textEditToCheck->hasFocus() == true) {
QString old = textEditToCheck->text();

keyboard* ereaderKeyboard = new keyboard(this);
keyboard* ereaderKeyboard = new keyboard();
ereaderKeyboard->start(textEditToCheck);
ereaderKeyboard->exec();
textEditToCheck->clearFocus();
Expand Down
2 changes: 1 addition & 1 deletion components/other/askText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void askText::manageKeyboards() {
QLineEdit* textEditToCheck = ui->lineEdit;
if((textEditToCheck->underMouse() == true && textEditToCheck->hasFocus() == true) || overwrite == true) {
overwrite = false;
keyboard* ereaderKeyboard = new keyboard(this);
keyboard* ereaderKeyboard = new keyboard();
ereaderKeyboard->start(textEditToCheck);
ereaderKeyboard->exec();
textEditToCheck->clearFocus();
Expand Down
8 changes: 5 additions & 3 deletions components/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void Settings::on_checkBox_stateChanged(int arg1)
void Settings::manageKeyboards() {
QLineEdit* textEditToCheck = ui->textIP;
if(textEditToCheck->underMouse() == true && textEditToCheck->hasFocus() == true) {
keyboard* ereaderKeyboard = new keyboard(this);
keyboard* ereaderKeyboard = new keyboard();
ereaderKeyboard->start(textEditToCheck);
int y = this->pos().y();
this->move(this->pos().x(), 0);
Expand All @@ -354,7 +354,8 @@ void Settings::manageKeyboards() {

void Settings::on_ButtonFontChange_clicked()
{
QFontDialog* dialog = new QFontDialog(this);
QFontDialog* dialog = new QFontDialog();
dialog->setAttribute(Qt::WA_DeleteOnClose);

if(ereader) {
dialog->show();
Expand Down Expand Up @@ -431,7 +432,8 @@ void Settings::on_buttonDebuggingData_clicked()
void Settings::on_audioButton_clicked()
{
#ifdef EREADER
QDialog* newAudioDialog = new audioDialog(this);
QDialog* newAudioDialog = new audioDialog();
newAudioDialog->setAttribute(Qt::WA_DeleteOnClose);
newAudioDialog->exec();
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion components/statusBarC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void statusBarC::on_ButtonSettings_clicked()
}

if(pomodoroCreated == false) {
pomodoroWidget = new pomodoro(this); // parent issue with showing?
pomodoroWidget = new pomodoro(); // parent issue with showing?
pomodoroCreated = true;
}

Expand Down
7 changes: 6 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ int main(int argc, char *argv[])
// It has some issues:
// Mainwindow cannot be added to a layout anymore, it refuses: Just use qwidget
// QDialogs aren't using this render, they cause even more flashing by using full screen flashing?
// Actually maybe? when dialogs have a parent in this mode, they have a window frame with an X button. Idk i cant delete it
// Sometimes *** Error in `/sanki': double free or corruption (out): 0x7ebebbf0 *** appears? idk if im closing it right
qGraphicsSceneEvents scene;
if(grender == true) {
qDebug() << "Applying graphics layer for ereader";
Expand Down Expand Up @@ -316,5 +318,8 @@ int main(int argc, char *argv[])
w.show();
#endif

return a.exec();
a.exec();

qDebug() << "App exited... Goodbye";
exit(0);
}
2 changes: 1 addition & 1 deletion mainMenu/decks/editDeck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void editDeck::on_lineeditDeckName_textChanged(const QString &arg1)
void editDeck::manageKeyboards() {
QLineEdit* textEditToCheck = ui->lineeditDeckName;
if(textEditToCheck->underMouse() == true && textEditToCheck->hasFocus() == true) {
keyboard* ereaderKeyboard = new keyboard(this);
keyboard* ereaderKeyboard = new keyboard();
ereaderKeyboard->start(textEditToCheck);
int y = this->pos().y();
this->move(this->pos().x(), 0);
Expand Down
12 changes: 10 additions & 2 deletions mainMenu/mainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void MainWindow::statusBarSessionAdd()

if(ereader) {
statusBarCWidget->OptionButtonExit(QIcon(":/icons/close.png"), true);
connect(statusBarCWidget, &statusBarC::closeButtonSignal, this, &MainWindow::close);
connect(statusBarCWidget, &statusBarC::closeButtonSignal, this, &MainWindow::exitApp);
} else {
statusBarCWidget->OptionButtonExit(QIcon(), false);
}
Expand Down Expand Up @@ -292,7 +292,7 @@ void MainWindow::createSession() {
"", &continueCreating);
}
if(ereader) {
askText* askTextDialog = new askText(this);
askText* askTextDialog = new askText();
askTextDialog->textToSet = &text;
askTextDialog->setTittle("Name for the new session");
int code = askTextDialog->exec();
Expand Down Expand Up @@ -396,3 +396,11 @@ void MainWindow::updateGrid() {
void MainWindow::gestureSlot(QEvent* event) {
emit gestureSignal(event);
}

void MainWindow::exitApp() {
qDebug() << "Exiting app...";
if(grender == true) {
graphic->close();
}

}
1 change: 1 addition & 0 deletions mainMenu/mainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public slots:
void playSession(sessionStr sessionPlay);

void gestureSlot(QEvent* event);
void exitApp();

private slots:
void extractDeck();
Expand Down
3 changes: 2 additions & 1 deletion mainMenu/sessions/editSesion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ editSession::editSession(QWidget *parent) :
{
ui->setupUi(this);
this->setAttribute(Qt::WA_DeleteOnClose);
this->setModal(true);

if(ereader) {
timer = new QTimer(this);
Expand Down Expand Up @@ -105,7 +106,7 @@ void editSession::on_removeSession_toggled(bool checked) {
void editSession::manageKeyboards() {
QLineEdit* textEditToCheck = ui->lineEdit;
if(textEditToCheck->underMouse() == true && textEditToCheck->hasFocus() == true) {
keyboard* ereaderKeyboard = new keyboard(this);
keyboard* ereaderKeyboard = new keyboard();
ereaderKeyboard->start(textEditToCheck);
int y = this->pos().y();
this->move(this->pos().x(), 0);
Expand Down
2 changes: 1 addition & 1 deletion mainMenu/sessions/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void session::on_ButtonDeckPlay_clicked()

void session::on_ButtonOptions_clicked()
{
editSession* editSessionDialog = new editSession(this);
editSession* editSessionDialog = new editSession();
connect(editSessionDialog, &editSession::refreshSessionsSignal, this, &session::refreshSessionsSlot);
editSessionDialog->start(sessionSaved);
editSessionDialog->exec();
Expand Down

0 comments on commit e3f6221

Please sign in to comment.