-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
43 lines (34 loc) · 1.26 KB
/
main.cpp
File metadata and controls
43 lines (34 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "gitmanager.h"
#include "mainwindow.h"
#include <QApplication>
#include <QFileDialog>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
app.setOrganizationDomain("com.github.shanmukhateja");
app.setApplicationName("gitraven-qt");
app.setWindowIcon(QIcon::fromTheme("git"));
std::optional<QString> gitRepoPath;
if (argc > 1) {
bool isDir = std::filesystem::is_directory(argv[1]);
if (isDir) gitRepoPath = argv[1];
}
if (!gitRepoPath.has_value())
{
// Show dialog to select repo directory
auto repoPath = QFileDialog::getExistingDirectory(nullptr,
"Open Directory",
nullptr,
QFileDialog::ShowDirsOnly
| QFileDialog::DontResolveSymlinks
);
if (!repoPath.isEmpty()) gitRepoPath = repoPath;
}
if (!gitRepoPath.has_value()) return 0;
// Git init
GitManager *manager = new GitManager(gitRepoPath.value());
// MainWindow
MainWindow w(manager);
w.show();
return app.exec();
}