handle gvr-interface address lookup

This commit is contained in:
Stephen Birarda 2015-01-20 14:38:33 -08:00
parent 17979d962f
commit 94a9bf52fa
7 changed files with 15 additions and 23 deletions

View file

@ -15,7 +15,6 @@
#include <QtWidgets/QApplication>
class RenderingClient;
class GVRMainWindow;
#if defined(qApp)
#undef qApp
@ -26,14 +25,10 @@ class GVRInterface : public QApplication {
Q_OBJECT
public:
GVRInterface(int argc, char* argv[]);
void setMainWindow(GVRMainWindow* mainWindow) { _mainWindow = mainWindow; }
GVRMainWindow* getMainWindow() { return _mainWindow; }
RenderingClient* getClient() { return _client; }
private:
GVRMainWindow* _mainWindow;
RenderingClient* _client;
};

View file

@ -9,9 +9,12 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <QtWidgets/QApplication>
#include <QtWidgets/QInputDialog>
#include <QtWidgets/QMenuBar>
#include "GVRInterface.h"
#include <AddressManager.h>
#include "RenderingClient.h"
#include "GVRMainWindow.h"
@ -31,6 +34,11 @@ GVRMainWindow::GVRMainWindow(QWidget* parent) :
fileMenu->addAction(goToAddress);
helpMenu->addAction(aboutQt);
QObject::connect(goToAddress, &QAction::triggered, qApp->getClient(), &RenderingClient::showAddressBar);
QObject::connect(goToAddress, &QAction::triggered, this, &GVRMainWindow::showAddressBar);
QObject::connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
}
void GVRMainWindow::showAddressBar() {
QString addressString = QInputDialog::getText(centralWidget(), "Go to Address", "Address");
DependencyManager::get<AddressManager>()->handleLookupString(addressString);
}

View file

@ -18,6 +18,8 @@ class GVRMainWindow : public QMainWindow {
Q_OBJECT
public:
GVRMainWindow(QWidget* parent = 0);
public slots:
void showAddressBar();
};
#endif // hifi_GVRMainWindow_h

View file

@ -11,9 +11,6 @@
#include <QtWidgets/QInputDialog>
#include "GVRInterface.h"
#include "GVRMainWindow.h"
#include "RenderingClient.h"
RenderingClient::RenderingClient(QObject *parent) :
@ -21,9 +18,3 @@ RenderingClient::RenderingClient(QObject *parent) :
{
}
void RenderingClient::showAddressBar() {
#ifdef Q_OS_ANDROID
QString addressString = QInputDialog::getText(qApp->getMainWindow()->centralWidget(), "Go to Address", "Address");
#endif
}

View file

@ -19,8 +19,6 @@ class RenderingClient : public Client {
Q_OBJECT
public:
RenderingClient(QObject* parent = 0);
public slots:
void showAddressBar();
};
#endif // hifi_RenderingClient_h

View file

@ -18,7 +18,5 @@ int main(int argc, char* argv[]) {
GVRMainWindow mainWindow;
mainWindow.showMaximized();
app.setMainWindow(&mainWindow);
return app.exec();
}

View file

@ -27,7 +27,7 @@
#include "AccountManager.h"
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = true;
AccountManager& AccountManager::getInstance(bool forceReset) {
static std::unique_ptr<AccountManager> sharedInstance(new AccountManager());
@ -59,7 +59,7 @@ JSONCallbackParameters::JSONCallbackParameters(QObject* jsonCallbackReceiver, co
}
AccountManager::AccountManager() :
_authURL(),
_authURL(DEFAULT_NODE_AUTH_URL),
_pendingCallbackMap(),
_accountInfo(),
_shouldPersistToSettingsFile(true)