mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 12:28:02 +02:00
hookup basic input dialog for address bar
This commit is contained in:
parent
5704ed78ff
commit
17979d962f
10 changed files with 1218 additions and 5 deletions
1084
CMakeLists.txt.user.18
Normal file
1084
CMakeLists.txt.user.18
Normal file
File diff suppressed because it is too large
Load diff
|
@ -11,10 +11,13 @@
|
||||||
|
|
||||||
#include <QtWidgets/QMenuBar>
|
#include <QtWidgets/QMenuBar>
|
||||||
|
|
||||||
|
#include "GVRMainWindow.h"
|
||||||
|
#include "RenderingClient.h"
|
||||||
|
|
||||||
#include "GVRInterface.h"
|
#include "GVRInterface.h"
|
||||||
|
|
||||||
GVRInterface::GVRInterface(int argc, char* argv[]) :
|
GVRInterface::GVRInterface(int argc, char* argv[]) :
|
||||||
QApplication(argc, argv)
|
QApplication(argc, argv)
|
||||||
{
|
{
|
||||||
|
_client = new RenderingClient(this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,27 @@
|
||||||
|
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
|
|
||||||
|
class RenderingClient;
|
||||||
|
class GVRMainWindow;
|
||||||
|
|
||||||
|
#if defined(qApp)
|
||||||
|
#undef qApp
|
||||||
|
#endif
|
||||||
|
#define qApp (static_cast<GVRInterface*>(QApplication::instance()))
|
||||||
|
|
||||||
class GVRInterface : public QApplication {
|
class GVRInterface : public QApplication {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GVRInterface(int argc, char* argv[]);
|
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
|
#endif // hifi_GVRInterface_h
|
||||||
|
|
|
@ -9,12 +9,16 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <QtWidgets/QApplication>
|
|
||||||
#include <QtWidgets/QMenuBar>
|
#include <QtWidgets/QMenuBar>
|
||||||
|
|
||||||
|
#include "GVRInterface.h"
|
||||||
|
#include "RenderingClient.h"
|
||||||
|
|
||||||
#include "GVRMainWindow.h"
|
#include "GVRMainWindow.h"
|
||||||
|
|
||||||
GVRMainWindow::GVRMainWindow() {
|
GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
||||||
|
QMainWindow(parent)
|
||||||
|
{
|
||||||
QMenu *fileMenu = new QMenu("File");
|
QMenu *fileMenu = new QMenu("File");
|
||||||
QMenu *helpMenu = new QMenu("Help");
|
QMenu *helpMenu = new QMenu("Help");
|
||||||
|
|
||||||
|
@ -27,5 +31,6 @@ GVRMainWindow::GVRMainWindow() {
|
||||||
fileMenu->addAction(goToAddress);
|
fileMenu->addAction(goToAddress);
|
||||||
helpMenu->addAction(aboutQt);
|
helpMenu->addAction(aboutQt);
|
||||||
|
|
||||||
|
QObject::connect(goToAddress, &QAction::triggered, qApp->getClient(), &RenderingClient::showAddressBar);
|
||||||
QObject::connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
|
QObject::connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
class GVRMainWindow : public QMainWindow {
|
class GVRMainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GVRMainWindow();
|
GVRMainWindow(QWidget* parent = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_GVRMainWindow_h
|
#endif // hifi_GVRMainWindow_h
|
||||||
|
|
29
gvr-interface/src/RenderingClient.cpp
Normal file
29
gvr-interface/src/RenderingClient.cpp
Normal 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
|
||||||
|
}
|
26
gvr-interface/src/RenderingClient.h
Normal file
26
gvr-interface/src/RenderingClient.h
Normal 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
|
24
gvr-interface/src/client.cpp
Normal file
24
gvr-interface/src/client.cpp
Normal 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);
|
||||||
|
}
|
23
gvr-interface/src/client.h
Normal file
23
gvr-interface/src/client.h
Normal 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
|
|
@ -18,5 +18,7 @@ int main(int argc, char* argv[]) {
|
||||||
GVRMainWindow mainWindow;
|
GVRMainWindow mainWindow;
|
||||||
mainWindow.showMaximized();
|
mainWindow.showMaximized();
|
||||||
|
|
||||||
|
app.setMainWindow(&mainWindow);
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
Loading…
Reference in a new issue