Skip to content

Commit 450e14d

Browse files
Added "method" key to defaults.json, reamed files.
A new key ("method") has been added to defaults.json, which determines the default activation mode to be used when starting the program. Also renamed project filenames to remove uppercases in order to increase compatibility with case-sensitive filesystems.
1 parent 578a0ec commit 450e14d

File tree

6 files changed

+32
-12
lines changed

6 files changed

+32
-12
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
/*
2+
23
!source/
4+
35
!.gitignore
46
!LICENSE
57
!README.md
68
!screenshots
7-
*.user
9+
10+
!*.pro
11+
*.user
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
QT += core gui widgets
22

3-
TARGET = CursorLocker
3+
TARGET = cursor-locker
44
TEMPLATE = app
55

66
DEFINES += QT_DEPRECATED_WARNINGS
@@ -11,15 +11,15 @@ CONFIG(debug, debug|release): DEFINES += DEBUG
1111
CONFIG(release, debug|release): DEFINES += RELEASE
1212

1313
SOURCES += \
14-
main.cxx \
15-
main_window_dlg.cxx
14+
source\main.cxx \
15+
source\main_wnd.cxx
1616

1717
HEADERS += \
18-
main_window_dlg.hxx \
19-
json.hxx
18+
source\main_wnd.hxx \
19+
source\json.hxx
2020

2121
FORMS += \
22-
main_window_dlg.ui
22+
source\main_wnd.ui
2323

2424
LIBS += \
2525
-lUser32

source/main.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <QApplication>
22

3-
#include "main_window_dlg.hxx"
3+
#include "main_wnd.hxx"
44

55
int main(int argc, char* argv[]) {
66
QApplication application(argc, argv);

source/main_window_dlg.cxx renamed to source/main_wnd.cxx

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "main_window_dlg.hxx"
2-
#include "ui_main_window_dlg.h"
1+
#include "main_wnd.hxx"
2+
#include "ui_main_wnd.h"
33

44
enum struct MONITOR_FOR {
55
NOTHING = 0b00000000,
@@ -300,6 +300,7 @@ void MainWindow::closeEvent(QCloseEvent*) {
300300

301301
bool MainWindow::LoadStylesheetFile(const std::string& file_path) {
302302
std::ifstream input_stream(file_path, std::ios::binary);
303+
303304
if(input_stream.good()) {
304305
std::string style_sheet((std::istreambuf_iterator<char>(input_stream)), (std::istreambuf_iterator<char>()));
305306
input_stream.close();
@@ -370,6 +371,8 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
370371

371372
logToConsole("Default values from defaults.json have been parsed.");
372373

374+
uint8_t default_cbx_activation_method_index = 0;
375+
373376
for(const auto& pair : default_values.items()) {
374377
if(pair.key() == "vkid") {
375378
std::stringstream conversion_stream;
@@ -401,16 +404,29 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWi
401404
monitoringWorkerTitle.store(heap_copy);
402405

403406
logToConsole({"Loaded window title(", QString::fromStdString(pair.value()),") from defaults.json"});
407+
} else if(pair.key() == "method") {
408+
if(pair.value() == "vkid") {
409+
default_cbx_activation_method_index = 1;
410+
} else if(pair.value() == "image") {
411+
default_cbx_activation_method_index = 2;
412+
} else if(pair.value() == "title") {
413+
default_cbx_activation_method_index = 3;
414+
}
415+
416+
logToConsole({"Loaded activation method(", QString::fromStdString(pair.value()),") from defaults.json"});
404417
}
405418
}
419+
420+
ui->cbx_activation_method->setCurrentIndex(default_cbx_activation_method_index);
406421
} else {
407422
std::ofstream output_stream("./defaults.json", std::ios::binary);
408423

409424
if(output_stream.good()) {
410425
Json json_template = {
411426
{"vkid", ""},
412427
{"image", ""},
413-
{"title", ""}
428+
{"title", ""},
429+
{"method", ""}
414430
};
415431

416432
const std::string& dumped_json = json_template.dump(4);
File renamed without changes.

source/main_window_dlg.ui renamed to source/main_wnd.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</size>
1818
</property>
1919
<property name="windowTitle">
20-
<string>CursorLocker Redux</string>
20+
<string>Cursor Locker</string>
2121
</property>
2222
<property name="iconSize">
2323
<size>

0 commit comments

Comments
 (0)