Skip to content

Commit

Permalink
client/gui: Small changes based on review feedback
Browse files Browse the repository at this point in the history
- Use QCoreApplication::exec() instead of explicit QEventLoop
- Use QApplication object methods instead of static methods
- Fix header #define
  • Loading branch information
Chris Townsend committed Feb 12, 2019
1 parent e1af97c commit 1221593
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/client/gui/argparser.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*
*/

#ifndef ARGPARSER_H
#define ARGPARSER_H
#ifndef MULTIPASS_ARGPARSER_H
#define MULTIPASS_ARGPARSER_H

#include <QCommandLineParser>

Expand All @@ -33,4 +33,4 @@ class ArgParser : public QCommandLineParser
int verbosity_level{0};
};
} // namespace multipass
#endif // ARGPARSER_H
#endif // MULTIPASS_ARGPARSER_H
6 changes: 2 additions & 4 deletions src/client/gui/gui_cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <multipass/cli/client_platform.h>
#include <multipass/cli/format_utils.h>

#include <QEventLoop>
#include <QCoreApplication>
#include <QTimer>
#include <QtConcurrent/QtConcurrent>

Expand All @@ -38,13 +38,11 @@ mp::ReturnCode cmd::GuiCmd::run(mp::ArgParser* parser)
return ReturnCode::CommandFail;
}

QEventLoop loop;

create_actions();
create_menu();
tray_icon.show();

return static_cast<ReturnCode>(loop.exec());
return static_cast<ReturnCode>(QCoreApplication::exec());
}

std::string cmd::GuiCmd::name() const
Expand Down
4 changes: 2 additions & 2 deletions src/client/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ namespace mp = multipass;
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QCoreApplication::setApplicationName("multipass-gui");
app.setApplicationName("multipass-gui");

mp::ClientConfig config{mp::client::get_server_address(), mp::RpcConnectionType::ssl,
std::move(mp::client::get_cert_provider()), std::cout, std::cerr};
mp::ClientGui client{config};

return client.run(QCoreApplication::arguments());
return client.run(app.arguments());
}

0 comments on commit 1221593

Please sign in to comment.