hookup basic input dialog for address bar

This commit is contained in:
Stephen Birarda 2015-01-20 14:26:32 -08:00
parent 5704ed78ff
commit 17979d962f
10 changed files with 1218 additions and 5 deletions

1084
CMakeLists.txt.user.18 Normal file

File diff suppressed because it is too large Load diff

View file

@ -11,10 +11,13 @@
#include <QtWidgets/QMenuBar>
#include "GVRMainWindow.h"
#include "RenderingClient.h"
#include "GVRInterface.h"
GVRInterface::GVRInterface(int argc, char* argv[]) :
QApplication(argc, argv)
{
}
_client = new RenderingClient(this);
}

View file

@ -14,10 +14,27 @@
#include <QtWidgets/QApplication>
class RenderingClient;
class GVRMainWindow;
#if defined(qApp)
#undef qApp
#endif
#define qApp (static_cast<GVRInterface*>(QApplication::instance()))
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;
};
#endif // hifi_GVRInterface_h

View file

@ -9,12 +9,16 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <QtWidgets/QApplication>
#include <QtWidgets/QMenuBar>
#include "GVRInterface.h"
#include "RenderingClient.h"
#include "GVRMainWindow.h"
GVRMainWindow::GVRMainWindow() {
GVRMainWindow::GVRMainWindow(QWidget* parent) :
QMainWindow(parent)
{
QMenu *fileMenu = new QMenu("File");
QMenu *helpMenu = new QMenu("Help");
@ -27,5 +31,6 @@ GVRMainWindow::GVRMainWindow() {
fileMenu->addAction(goToAddress);
helpMenu->addAction(aboutQt);
QObject::connect(goToAddress, &QAction::triggered, qApp->getClient(), &RenderingClient::showAddressBar);
QObject::connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
}

View file

@ -17,7 +17,7 @@
class GVRMainWindow : public QMainWindow {
Q_OBJECT
public:
GVRMainWindow();
GVRMainWindow(QWidget* parent = 0);
};
#endif // hifi_GVRMainWindow_h

View file

@ -0,0 +1,29 @@
//
// RenderingClient.cpp
// gvr-interface/src
//
// Created by Stephen Birarda on 1/20/15.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <QtWidgets/QInputDialog>
#include "GVRInterface.h"
#include "GVRMainWindow.h"
#include "RenderingClient.h"
RenderingClient::RenderingClient(QObject *parent) :
Client(parent)
{
}
void RenderingClient::showAddressBar() {
#ifdef Q_OS_ANDROID
QString addressString = QInputDialog::getText(qApp->getMainWindow()->centralWidget(), "Go to Address", "Address");
#endif
}

View file

@ -0,0 +1,26 @@
//
// RenderingClient.h
// gvr-interface/src
//
// Created by Stephen Birarda on 1/20/15.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_RenderingClient_h
#define hifi_RenderingClient_h
#include "Client.h"
class RenderingClient : public Client {
Q_OBJECT
public:
RenderingClient(QObject* parent = 0);
public slots:
void showAddressBar();
};
#endif // hifi_RenderingClient_h

View file

@ -0,0 +1,24 @@
//
// Client.cpp
// gvr-interface/src
//
// Created by Stephen Birarda on 1/20/15.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include <AddressManager.h>
#include <NodeList.h>
#include "Client.h"
Client::Client(QObject* parent) :
QObject(parent)
{
DependencyManager::set<AddressManager>();
// setup the NodeList for this client
auto nodeList = DependencyManager::set<NodeList>(NodeType::Agent, 0);
}

View file

@ -0,0 +1,23 @@
//
// Client.h
// gvr-interface/src
//
// Created by Stephen Birarda on 1/20/15.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_Client_h
#define hifi_Client_h
#include <QtCore/QObject>
class Client : public QObject {
Q_OBJECT
public:
Client(QObject* parent = 0);
};
#endif // hifi_Client_h

View file

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