diff --git a/GPClient/gpclient.cpp b/GPClient/gpclient.cpp index a637b8d..23c77f5 100644 --- a/GPClient/gpclient.cpp +++ b/GPClient/gpclient.cpp @@ -40,14 +40,6 @@ GPClient::GPClient(QWidget *parent, IVpn *vpn) initVpnStatus(); } -GPClient::~GPClient() -{ - delete ui; - delete vpn; - delete settingsDialog; - delete settingsButton; -} - void GPClient::setupSettings() { settingsButton = new QPushButton(this); @@ -112,7 +104,7 @@ void GPClient::initSystemTrayIcon() connectAction = contextMenu->addAction(QIcon::fromTheme("preferences-system-network"), "Connect", this, &GPClient::doConnect); contextMenu->addMenu(gatewaySwitchMenu); contextMenu->addSeparator(); - clearAction = contextMenu->addAction(QIcon::fromTheme("edit-clear"), "Reset", this, &GPClient::clearSettings); + clearAction = contextMenu->addAction(QIcon::fromTheme("edit-clear"), "Reset", this, &GPClient::reset); quitAction = contextMenu->addAction(QIcon::fromTheme("application-exit"), "Quit", this, &GPClient::quit); systemTrayIcon->show(); @@ -478,7 +470,7 @@ void GPClient::setCurrentGateway(const GPGateway gateway) populateGatewayMenu(); } -void GPClient::clearSettings() +void GPClient::reset() { settings::clear(); populateGatewayMenu(); diff --git a/GPClient/gpclient.h b/GPClient/gpclient.h index 051a0a2..20abad4 100644 --- a/GPClient/gpclient.h +++ b/GPClient/gpclient.h @@ -21,7 +21,6 @@ class GPClient : public QMainWindow public: GPClient(QWidget *parent, IVpn *vpn); - ~GPClient(); void activate(); void quit(); @@ -33,6 +32,7 @@ public: void setCurrentGateway(const GPGateway gateway); void doConnect(); + void reset(); private slots: void onSettingsButtonClicked(); @@ -81,8 +81,6 @@ private: SettingsDialog *settingsDialog; QPushButton *settingsButton; - GatewayAuthenticator *gatewayAuthenticator; - bool isQuickConnect { false }; bool isSwitchingGateway { false }; PortalConfigResponse portalConfig; @@ -102,7 +100,5 @@ private: QList allGateways() const; void setAllGateways(QList gateways); - - void clearSettings(); }; #endif // GPCLIENT_H diff --git a/GPClient/main.cpp b/GPClient/main.cpp index 1610ab0..f3f1269 100644 --- a/GPClient/main.cpp +++ b/GPClient/main.cpp @@ -46,6 +46,7 @@ int main(int argc, char *argv[]) {"json", "Write the result of the handshake with the GlobalConnect server to stdout as JSON and terminate. Useful for scripting."}, {"now", "Do not show the dialog with the connect button; connect immediately instead."}, {"start-minimized", "Launch the client minimized."}, + {"reset", "Reset the client's settings."}, }); parser.process(app); @@ -55,7 +56,11 @@ int main(int argc, char *argv[]) ? static_cast(new VpnJson(nullptr)) // Print to stdout and exit : static_cast(new VpnDbus(nullptr)); // Contact GPService daemon via dbus GPClient w(nullptr, vpn); + parser.isSet("start-minimized") ? w.showMinimized() : w.show(); + if (parser.isSet("reset")) { + w.reset(); + } if (positional.size() > 0) { w.portal(positional.at(0));