Skip to content

Commit 974a44f

Browse files
committed
Merge branch 'master' into java-integration
* master: Updated Windows build instructions Added comments added icon and Qt attribution. Fixed #42 Added logout button in menu
2 parents 4647794 + 7a758b6 commit 974a44f

File tree

6 files changed

+48
-8
lines changed

6 files changed

+48
-8
lines changed

ATTRIBUTION.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Icons made by [Freepik](https://www.flaticon.com/authors/freepik) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
2+
Icons made by [Smashicons](https://www.flaticon.com/authors/smashicons) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
3+
Icons made by [Gregor Cresnar](https://www.flaticon.com/authors/gregor-cresnar) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
4+
Icons made by [Dave Gandy](https://www.flaticon.com/authors/dave-gandy) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
5+
Icons made by [Bogdan Rosu](https://www.flaticon.com/authors/bogdan-rosu) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
6+
Icons made by [Egor Rumyantsev](https://www.flaticon.com/authors/egor-rumyantsev) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
7+
Icons made by [Hanan](https://www.flaticon.com/authors/hanan) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
8+
Icons made by [Those Icons](https://www.flaticon.com/authors/those-icons) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
9+
Icons made by [Google](https://www.flaticon.com/authors/google) from www.flaticon.com is licensed by [CC 3.0 BY](http://creativecommons.org/licenses/by/3.0/)
10+
11+
[Qt](www.qt.io) is licensed by [LGPLv3](opensource.org/licenses/lgpl-3.0.html)

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,18 @@ cmake --build .
2929
```
3030

3131
## Build on Windows
32-
1. Install [CMake](https://cmake.org/download/), [Qt](https://www.qt.io/download), [Visual Studio](https://www.visualstudio.com/downloads/), and [Vcpkg](https://github.com/Microsoft/vcpkg).
32+
1. Install [CMake](https://cmake.org/download/), [Qt5](https://www.qt.io/download), [Visual Studio](https://www.visualstudio.com/downloads/).
3333
- Must install "MSVC 2015 32-bit" Qt library.
3434
- For Visual Studio, **Community** edition is fine, pick the "Desktop development with C++" option, or at least VC++.
35-
- Follow quick start instructions to install Vcpkg, making sure your install directory is that same as in CMakeLists.txt.
3635
- You must add Qt to the path (`setx CMAKE_PREFIX_PATH "C:\Qt\5.10.1\msvc2015"`)
37-
2. Update submodules: `git submodule update --init --recursive`
38-
3. Using the **Qt Command Prompt** (Qt 32-bit for Desktop (MSVC)), navigate to the project directory, then run:
36+
2. Using the **Qt Command Prompt** (Qt 32-bit for Desktop (MSVC)), navigate to the project directory, then run:
3937
- `mkdir build`
4038
- `cd build`
4139
- `cmake ..`
4240
- `cmake --build .` (or `msbuild /m facade-application.sln` in VS developer command prompt for multicore building)
43-
4. Copy all resources from the folder and subfolders of `C:\mygcc-application\res\` to `C:\mygcc-application\build\Debug`
44-
5. Include `mygcc-api-with-dependencies.jar` from [mygcc-api](https://github.com/davidcorbin/mygcc-api).
45-
6. Copy needed DLLs from `C:\Qt\5.10.1\msvc2015\bin` to `C:\mygcc-application\build\Debug`
41+
3. Copy all resources from the folder and subfolders of `C:\mygcc-application\res\` to `C:\mygcc-application\build\Debug`
42+
4. Include `mygcc-api-with-dependencies.jar` from [mygcc-api](https://github.com/davidcorbin/mygcc-api).
43+
5. Copy needed DLLs from `C:\Qt\5.10.1\msvc2015\bin` to `C:\mygcc-application\build\Debug`
4644

4745
## Build Documentation
4846
Generating documentation requires Doxygen

include/data/Login.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Login : public QObject {
1919
bool isApiConnectionEstablished() const;
2020
void queueLogin();
2121
void saveToken(std::string *token);
22+
void deleteUserData();
2223
std::string *getApiToken() const;
2324

2425
private:

include/ui/MainWindow.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,13 @@ class MainWindow : public QMainWindow {
6262

6363
void showHomeWidget();
6464

65+
QMenu *fileMenu;
66+
QAction *logoutAction;
67+
6568
private slots: // NOLINT
6669
void startupCallbackHandler();
6770
void logout();
71+
void logoutRestart();
6872
void addChapelGridItems();
6973
};
7074

src/data/Login.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,16 @@ bool Login::loadUserData() {
182182
return false;
183183
}
184184

185+
//
186+
// Deletes the userdata file, logging user out.
187+
//
188+
void Login::deleteUserData() {
189+
if (!datapath.empty()) {
190+
QFile file(datapath.c_str());
191+
file.remove();
192+
}
193+
}
194+
185195
//
186196
// Create user data json file.
187197
//

src/ui/MainWindow.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <QPainter>
1212
#include <QCloseEvent>
1313
#include <QCoreApplication>
14+
#include <QtWidgets>
1415
#include <vector>
1516
#include <string>
1617

@@ -52,6 +53,12 @@ MainWindow::MainWindow(JavaIntegration *ji,
5253
infogrid->setup();
5354

5455
connect(chapel, SIGNAL(chapelsReceived()), this, SLOT(addChapelGridItems()));
56+
57+
auto *logoutAction = new QAction(tr("&Log Out"), this);
58+
connect(logoutAction, SIGNAL(triggered()), this, SLOT(logoutRestart()));
59+
60+
fileMenu = menuBar()->addMenu(tr("&File"));
61+
fileMenu->addAction(logoutAction);
5562
}
5663

5764
void MainWindow::viewFeedbackPanel() {
@@ -172,6 +179,15 @@ void MainWindow::logout() {
172179
loginPanel->authFailure();
173180
}
174181

182+
void MainWindow::logoutRestart() {
183+
// Delete user data file
184+
login->deleteUserData();
185+
186+
// Quit application and restart
187+
qApp->quit();
188+
QProcess::startDetached(qApp->arguments()[0], qApp->arguments());
189+
}
190+
175191
void MainWindow::addChapelGridItems() {
176192
int remaining = chapel->getRemaining();
177193
int required = chapel->getRequired();
@@ -186,7 +202,7 @@ void MainWindow::addChapelGridItems() {
186202
Color::grid_blue()));
187203

188204
// Percent of chapels completed
189-
int pc = static_cast<int>(((attended/
205+
auto pc = static_cast<int>(((attended/
190206
static_cast<float>(required + makeups))) * 100 + 0.5);
191207
QString percentHeader = QString("%1%").arg(QString::number(pc));
192208
infogrid->addGridItem(new GridItem(&percentHeader,

0 commit comments

Comments
 (0)