-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bde7dd5
commit d0044c6
Showing
5 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <QProcess> | ||
|
||
#include "startup.h" | ||
#include "..\Setting\setting.h" | ||
|
||
bool Startup::started = false; | ||
|
||
void Startup::startOnce() | ||
{ | ||
// Disable after fist run | ||
if (started) | ||
{ | ||
return; | ||
} | ||
started = true; | ||
|
||
// Get startup items | ||
auto afterPrefetch = Setting::getArray("AfterPrefetch", Setting::setting); | ||
for (int i = 0; i < afterPrefetch.size(); ++i) | ||
{ | ||
auto fileName = afterPrefetch[i]; | ||
|
||
QProcess process; | ||
|
||
// Cool stuff | ||
// Use startDetached to avoid print to console | ||
// QProcess: Destroyed while process is still running. | ||
process.startDetached(fileName); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Static class | ||
class Startup | ||
{ | ||
public: | ||
// This function will only run once | ||
static void startOnce(); | ||
|
||
private: | ||
// Disallow creating an instance of this object | ||
Startup() {} | ||
|
||
// After run set to true | ||
static bool started; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters