mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 03:24:07 +02:00
load webpage if tablet root is not initialized
This commit is contained in:
parent
4cc8db8aff
commit
ab9432c1cd
2 changed files with 23 additions and 4 deletions
|
@ -282,6 +282,7 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
|||
_desktopWindow = nullptr;
|
||||
}
|
||||
}
|
||||
qDebug() << "-------> current path " << _currentPathLoaded;
|
||||
}
|
||||
|
||||
static void addButtonProxyToQmlTablet(QQuickItem* qmlTablet, TabletButtonProxy* buttonProxy) {
|
||||
|
@ -328,7 +329,8 @@ void TabletProxy::initialScreen(const QVariant& url) {
|
|||
pushOntoStack(url);
|
||||
} else {
|
||||
_initialScreen = true;
|
||||
_initialPath = url;
|
||||
_initialPath.first = url;
|
||||
_initialPath.second = State::QML;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -416,10 +418,18 @@ void TabletProxy::setQmlTabletRoot(OffscreenQmlSurface* qmlOffscreenSurface) {
|
|||
});
|
||||
|
||||
if (_initialScreen) {
|
||||
if (!_showRunningScripts) {
|
||||
pushOntoStack(_initialPath);
|
||||
if (!_showRunningScripts && _initialPath.second == State::QML) {
|
||||
pushOntoStack(_initialPath.first);
|
||||
} else if (_initialPath.second == State::Web) {
|
||||
QVariant webUrl = _initialPath.first;
|
||||
QVariant scriptUrl = _initialWebPathParams.first;
|
||||
gotoWebScreen(webUrl.toString(), scriptUrl.toString(), _initialWebPathParams.second);
|
||||
}
|
||||
_initialScreen = false;
|
||||
_initialPath.first = "";
|
||||
_initialPath.second = State::Uninitialized;
|
||||
_initialWebPathParams.first = "";
|
||||
_initialWebPathParams.second = false;
|
||||
}
|
||||
|
||||
if (_showRunningScripts) {
|
||||
|
@ -685,6 +695,14 @@ void TabletProxy::gotoWebScreen(const QString& url, const QString& injectedJavaS
|
|||
QMetaObject::invokeMethod(root, "setResizable", Q_ARG(const QVariant&, QVariant(false)));
|
||||
}
|
||||
QMetaObject::invokeMethod(root, "loadWebUrl", Q_ARG(const QVariant&, QVariant(url)), Q_ARG(const QVariant&, QVariant(injectedJavaScriptUrl)));
|
||||
} else {
|
||||
// tablet is not initialized yet, save information and load when
|
||||
// the tablet root is set
|
||||
_initialPath.first = url;
|
||||
_initialPath.second = State::Web;
|
||||
_initialWebPathParams.first = injectedJavaScriptUrl;
|
||||
_initialWebPathParams.second = loadOtherBase;
|
||||
_initialScreen = true;
|
||||
}
|
||||
_state = State::Web;
|
||||
emit screenChanged(QVariant("Web"), QVariant(url));
|
||||
|
|
|
@ -248,7 +248,6 @@ protected:
|
|||
void removeButtonsFromToolbar();
|
||||
|
||||
bool _initialScreen { false };
|
||||
QVariant _initialPath { "" };
|
||||
QVariant _currentPathLoaded { "" };
|
||||
QString _name;
|
||||
std::vector<QSharedPointer<TabletButtonProxy>> _tabletButtonProxies;
|
||||
|
@ -260,6 +259,8 @@ protected:
|
|||
|
||||
enum class State { Uninitialized, Home, Web, Menu, QML };
|
||||
State _state { State::Uninitialized };
|
||||
std::pair<QVariant, State> _initialPath { "", State::Uninitialized };
|
||||
std::pair<QVariant, bool> _initialWebPathParams;
|
||||
bool _landscape { false };
|
||||
bool _showRunningScripts { false };
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue