Skip to content

Commit 780150d

Browse files
committed
Bug fix 🦩
- Added MainWindow parent to popups, to prevent popups from: 1) being affected by AOT; and 2) popping up anywhere other than centered over the MainWindow
1 parent e170db7 commit 780150d

File tree

7 files changed

+31
-31
lines changed

7 files changed

+31
-31
lines changed

Fernanda/docs/To-do.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
- [ ] May need to remove and re-add icons / labels. They seem to be doubling up sometimes--visible r/g/b or pink outlines?
150150

151151
### Popup
152-
- [ ] Ensure popups happen on the same monitor...
152+
- [x] ~~Ensure popups happen on the same monitor...~~
153153

154154
### Preview
155155
- [ ] Need a default size to open to from toggle if not set (-1)

Fernanda/source/MainWindow.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ bool MainWindow::confirmStoryClose(bool isQuit)
6969
{
7070
if (!activeStory.has_value() || !activeStory.value().hasChanges()) return true;
7171
auto result = false;
72-
switch (Popup::confirm(isQuit)) {
72+
switch (Popup::confirm(this, isQuit)) {
7373
case Popup::OnClose::Close:
7474
result = true;
7575
break;
@@ -531,7 +531,7 @@ void MainWindow::makeHelpMenu()
531531
helpMenuUpdate();
532532
});
533533
connect(check_for_updates, &QAction::triggered, this, &MainWindow::helpMenuUpdate);
534-
connect(shortcuts, &QAction::triggered, this, [&]() { Popup::shortcuts(); });
534+
connect(shortcuts, &QAction::triggered, this, [&]() { Popup::shortcuts(this); });
535535
connect(documents, &QAction::triggered, this, [&]()
536536
{
537537
openLocalFolder(UserData::doThis(UserData::Operation::GetDocuments));
@@ -828,7 +828,7 @@ void MainWindow::storyMenuTotals()
828828
auto& story = activeStory.value();
829829
story.autoTempSave(editor->toPlainText());
830830
auto totals = story.totalCounts();
831-
Popup::totalCounts(totals.lines, totals.words, totals.characters);
831+
Popup::totalCounts(this, totals.lines, totals.words, totals.characters);
832832
}
833833

834834
void MainWindow::helpMenuMakeSampleProject()
@@ -842,7 +842,7 @@ void MainWindow::helpMenuMakeSampleRes()
842842
auto path = UserData::doThis(UserData::Operation::GetUserData);
843843
Sample::makeRc(path);
844844
colorBar->run(ColorBar::Run::Pastels);
845-
switch (Popup::sample()) {
845+
switch (Popup::sample(this)) {
846846
case Popup::Action::Accept:
847847
break;
848848
case Popup::Action::Open:
@@ -871,7 +871,7 @@ void MainWindow::helpMenuUpdate()
871871
}
872872
else
873873
result = Text::VersionCheck::Error;
874-
Popup::update(result, latest);
874+
Popup::update(this, result, latest);
875875
});
876876
}
877877

Fernanda/source/Popup.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
bool Popup::about(QWidget* parent)
1717
{
1818
auto result = false;
19-
QMessageBox about;
19+
QMessageBox about(parent);
2020
box(about, Text::about(), true, true);
2121
auto update = about.addButton(tr(Text::checkForUpdates().toLocal8Bit()), QMessageBox::AcceptRole);
2222
auto qt = about.addButton(tr("About Qt"), QMessageBox::AcceptRole);
@@ -26,10 +26,10 @@ bool Popup::about(QWidget* parent)
2626
return result;
2727
}
2828

29-
Popup::OnClose Popup::confirm(bool isQuit)
29+
Popup::OnClose Popup::confirm(QWidget* parent, bool isQuit)
3030
{
3131
auto result = OnClose::Close;
32-
QMessageBox alert;
32+
QMessageBox alert(parent);
3333
box(alert, Text::change(isQuit), false, false, "Hey!");
3434
alert.addButton(QMessageBox::Yes);
3535
auto no = alert.addButton(QMessageBox::No);
@@ -41,45 +41,45 @@ Popup::OnClose Popup::confirm(bool isQuit)
4141
return result;
4242
}
4343

44-
void Popup::shortcuts()
44+
void Popup::shortcuts(QWidget* parent)
4545
{
46-
QMessageBox shortcuts;
46+
QMessageBox shortcuts(parent);
4747
box(shortcuts, Text::shortcuts());
4848
shortcuts.exec();
4949
}
5050

51-
Popup::Action Popup::sample()
51+
Popup::Action Popup::sample(QWidget* parent)
5252
{
53-
QMessageBox alert;
53+
QMessageBox alert(parent);
5454
box(alert, Text::samples(), true, false, "Hey!");
5555
auto open = alert.addButton(tr(Text::openUdButton().toLocal8Bit()), QMessageBox::AcceptRole);
5656
alert.exec();
5757
if (alert.clickedButton() == open) return Action::Open;
5858
return Action::Accept;
5959
}
6060

61-
void Popup::update(Text::VersionCheck result, QString latestVersion)
61+
void Popup::update(QWidget* parent, Text::VersionCheck result, QString latestVersion)
6262
{
63-
QMessageBox version_check;
63+
QMessageBox version_check(parent);
6464
box(version_check, Text::version(result, latestVersion), true, true);
6565
version_check.exec();
6666
}
6767

68-
void Popup::timeUp()
68+
void Popup::timeUp(QWidget* parent)
6969
{
70-
QMessageBox time_up;
70+
QMessageBox time_up(parent);
7171
box(time_up, Text::timeUp());
7272
time_up.exec();
7373
}
7474

75-
void Popup::totalCounts(int lines, int words, int characters)
75+
void Popup::totalCounts(QWidget* parent, int lines, int words, int characters)
7676
{
77-
QMessageBox total_counts;
77+
QMessageBox total_counts(parent);
7878
box(total_counts, Text::totalCounts(lines, words, characters));
7979
total_counts.exec();
8080
}
8181

82-
void Popup::box(QMessageBox& box, QString text, bool hasOk, bool hasIcon, QString title, QWidget* parent)
82+
void Popup::box(QMessageBox& box, QString text, bool hasOk, bool hasIcon, QString title)
8383
{
8484
(title == nullptr)
8585
? box.setWindowTitle("Fernanda")

Fernanda/source/Popup.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ class Popup : public QObject
3838
};
3939

4040
static bool about(QWidget* parent);
41-
static OnClose confirm(bool isQuit);
42-
static void shortcuts();
43-
static Action sample();
44-
static void update(Text::VersionCheck result, QString latestVersion);
45-
static void timeUp();
46-
static void totalCounts(int lines, int words, int characters);
41+
static OnClose confirm(QWidget* parent, bool isQuit);
42+
static void shortcuts(QWidget* parent);
43+
static Action sample(QWidget* parent);
44+
static void update(QWidget* parent, Text::VersionCheck result, QString latestVersion);
45+
static void timeUp(QWidget* parent);
46+
static void totalCounts(QWidget* parent, int lines, int words, int characters);
4747

4848
private:
49-
static void box(QMessageBox& box, QString text, bool hasOk = true, bool hasIcon = false, QString title = nullptr, QWidget* parent = nullptr);
49+
static void box(QMessageBox& box, QString text, bool hasOk = true, bool hasIcon = false, QString title = nullptr);
5050
};
5151

5252
// Popup.h, Fernanda

Fernanda/source/Tool.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void Tool::countdownDisplay()
158158
setText(Text::pad(Icon::draw(Icon::Name::Timer) + " " + time(countdown_value), 2));
159159
if (countdown_value < 1)
160160
{
161-
Popup::timeUp();
161+
Popup::timeUp(parentWindow);
162162
setChecked(false);
163163
return;
164164
}

Fernanda/source/Version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
#pragma once
1515

16-
#define VER_FILEVERSION 0,26,1,57
17-
#define VER_FILEVERSION_STR "v0.26.1-beta57"
16+
#define VER_FILEVERSION 0,26,2,58
17+
#define VER_FILEVERSION_STR "v0.26.2-beta58"
1818
#define VER_PRODUCTVERSION VER_FILEVERSION
1919
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
2020
#define VER_COMPANYNAME_STR "fairybow"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Fernanda comes with several two-tone editor themes inspired by retro displays an
183183
**Tools:**
184184
<a id="features-tools"></a>
185185
- :pushpin: **Always on top:**
186-
- Pin Fernanda to the top of your window order (will interfere with popups!)
186+
- Pin Fernanda to the top of your window order
187187
- :bubble_tea: **Stay awake:**
188188
- Keep the screen awake without input (Windows only)
189189
- :timer_clock: **Timer:**

0 commit comments

Comments
 (0)