Skip to content

Commit e7ca2f6

Browse files
committed
Fix loading settings when launch with OS
1 parent ab23d94 commit e7ca2f6

File tree

5 files changed

+46
-29
lines changed

5 files changed

+46
-29
lines changed

main.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,24 @@ int main(int argc, char *argv[])
2424
QCoreApplication::setApplicationName("Double Click Fixer");
2525
QApplication *a = new QApplication(argc, argv);
2626
MainWindow *w = new MainWindow();
27-
w->show();
27+
28+
bool iShowMinimized = false;
29+
if(argc > 1)
30+
{
31+
for(int i = 1; i<argc;++i)
32+
{
33+
if(strcmp(argv[i], "-m")==0)
34+
{
35+
iShowMinimized = true;
36+
break;
37+
}
38+
}
39+
}
40+
if(iShowMinimized)
41+
w->showMinimized();
42+
else
43+
w->show();
44+
2845
int iReturn = a->exec();
2946

3047
delete w;

mainwindow.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ MainWindow::MainWindow(QWidget *parent) :
5252
}
5353
});
5454

55-
m_Settings = new QSettings(SETTINGS_ENTRY_NAME,QSettings::IniFormat);
55+
m_Settings = new QSettings(QDir::toNativeSeparators(QCoreApplication::applicationDirPath())+QDir::separator()+SETTINGS_ENTRY_NAME,QSettings::IniFormat);
5656
m_Settings->beginGroup("MAIN");
5757
QApplication::processEvents();
5858

mainwindow.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<enum>Qt::NoFocus</enum>
2424
</property>
2525
<property name="windowTitle">
26-
<string>QDoubleClickFix Beta 0.7.0</string>
26+
<string>QDoubleClickFix Beta 0.7.1</string>
2727
</property>
2828
<property name="windowIcon">
2929
<iconset resource="basic_resources.qrc">

meta_data.rc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ IDI_ICON1 ICON "icon.ico"
2020

2121
#include <windows.h>
2222

23-
#define VER_FILEVERSION 0,7,0
24-
#define VER_FILEVERSION_STR "0.7.0.0\0"
25-
#define VER_PRODUCTVERSION 0,7,0
26-
#define VER_PRODUCTVERSION_STR "0.6.7\0"
23+
#define VER_FILEVERSION 0,7,1
24+
#define VER_FILEVERSION_STR "0.7.1.0\0"
25+
#define VER_PRODUCTVERSION 0,7,1
26+
#define VER_PRODUCTVERSION_STR "0.7.1\0"
2727
#define VER_FILEDESCRIPTION_STR "Double Click Problem Fixer Tool"
2828
#define VER_INTERNALNAME_STR "DoubleClickFix"
2929
#define VER_LEGALCOPYRIGHT_STR "Copyright (C) 2016 Alik Aslanyan"

mousecatcherthread.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,28 @@ LRESULT inline MouseCatcherThread::MouseCallBackProc(int nCode, WPARAM wParam, L
7171
m_ClickTimer.restart();
7272

7373

74+
if(isMouseHoldAutoSelectionMode())
75+
{
76+
QTimer *t = new QTimer();
77+
t->setSingleShot(true);
78+
t->setInterval(getMouseHoldingDelay());
79+
t->moveToThread(this);
80+
connect(this, SIGNAL(mouse_up()), t, SLOT(stop()));
81+
connect(this, SIGNAL(mouse_up()), t, SLOT(deleteLater()));
82+
83+
connect(this, SIGNAL(finished()), t, SLOT(stop()));
84+
connect(this, SIGNAL(finished()), t, SLOT(deleteLater()));
85+
86+
87+
connect(t, &QTimer::timeout, [this](){
88+
89+
setSelectionMode(true);
90+
m_iToggled=true;
91+
});
92+
93+
94+
t->start();
95+
}
7496
bool needLog = isLoggingStarted();
7597

7698
if(getDelay()>=iMSecs)
@@ -104,28 +126,6 @@ LRESULT inline MouseCatcherThread::MouseCallBackProc(int nCode, WPARAM wParam, L
104126
{
105127
m_iToggled=!m_iToggled;
106128
}
107-
else if(isMouseHoldAutoSelectionMode())
108-
{
109-
QTimer *t = new QTimer();
110-
t->setSingleShot(true);
111-
t->setInterval(getMouseHoldingDelay());
112-
t->moveToThread(this);
113-
connect(this, SIGNAL(mouse_up()), t, SLOT(stop()));
114-
connect(this, SIGNAL(mouse_up()), t, SLOT(deleteLater()));
115-
116-
connect(this, SIGNAL(finished()), t, SLOT(stop()));
117-
connect(this, SIGNAL(finished()), t, SLOT(deleteLater()));
118-
119-
120-
connect(t, &QTimer::timeout, [this](){
121-
122-
setSelectionMode(true);
123-
m_iToggled=true;
124-
});
125-
126-
127-
t->start();
128-
}
129129
}
130130
break;
131131
}

0 commit comments

Comments
 (0)