Skip to content

Commit

Permalink
#4 #56 #59 Added Settings page, Max levels set to 21 with option to g…
Browse files Browse the repository at this point in the history
…o higher, Updated request timeout
  • Loading branch information
Jayson Ward committed Mar 26, 2018
1 parent 50a7f79 commit bd05947
Show file tree
Hide file tree
Showing 28 changed files with 592 additions and 116 deletions.
80 changes: 59 additions & 21 deletions AppToolBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Item {
property alias aboutButtonEnabled: aboutButton.enabled
property alias userButtonVisible: userButton.visible
property alias userButtonEnabled: userButton.enabled
property alias settingsButtonVisible: settingsButton.visible
property alias settingsButtonEnabled: settingsButton.enabled

// UI //////////////////////////////////////////////////////////////////////

Expand All @@ -84,7 +86,7 @@ Item {
//------------------------------------------------------------------

Button{
id:backButton
id: backButton
Layout.preferredWidth: toolBarHeight
Layout.fillHeight: true

Expand Down Expand Up @@ -112,7 +114,7 @@ Item {
Accessible.name: Singletons.Strings.goBackToPreviousView
Accessible.description: Singletons.Strings.goBackToPreviousViewDesc
Accessible.onPressAction: {
if(enabled && visible){
if (enabled && visible) {
clicked();
}
}
Expand Down Expand Up @@ -165,7 +167,7 @@ Item {
Accessible.ignored: true
}

Rectangle{
Rectangle {
id: numberOfUpdatesIndicator
visible: false
color: "orange"
Expand All @@ -176,7 +178,7 @@ Item {
anchors.right: updatesButton.right
anchors.topMargin: 4 * AppFramework.displayScaleFactor
anchors.rightMargin: 4 * AppFramework.displayScaleFactor
Text{
Text {
id: numberOfUpdatesIndicatorCount
anchors.centerIn: parent
text: "0"
Expand All @@ -193,23 +195,23 @@ Item {
Accessible.name: Singletons.Strings.xUpdatesAvaliable.arg(numberOfUpdatesIndicatorCount.text)
Accessible.description: Singletons.Strings.xUpdatesAvaliableDesc
Accessible.onPressAction: {
if(enabled && visible){
if (enabled && visible) {
clicked();
}
}
}

//------------------------------------------------------------------

Button{
Button {
id: feedbackButton
Layout.preferredWidth: toolBarHeight
Layout.fillHeight: true
ToolTip.visible: hovered
ToolTip.text: Singletons.Strings.feedback
enabled: true

background: Rectangle{
background: Rectangle {
color: toolBarBackground
anchors.fill: parent
}
Expand All @@ -230,7 +232,7 @@ Item {
Accessible.name: Singletons.Strings.feedback
Accessible.description: Singletons.Strings.feedbackDesc
Accessible.onPressAction: {
if(enabled && visible){
if (enabled && visible) {
clicked();
}
}
Expand Down Expand Up @@ -266,22 +268,58 @@ Item {
Accessible.name: Singletons.Strings.aboutTheApp
Accessible.description: Singletons.Strings.aboutTheAppDesc
Accessible.onPressAction: {
if(enabled && visible){
if (enabled && visible) {
clicked();
}
}
}

//------------------------------------------------------------------

Button{
Button {
id: settingsButton
Layout.preferredWidth: toolBarHeight
Layout.fillHeight: true
ToolTip.visible: hovered
ToolTip.text: Singletons.Strings.settings

background: Rectangle {
color: toolBarBackground
anchors.fill: parent
}

IconFont {
anchors.centerIn: parent
icon: _icons.settings
iconSizeMultiplier: 1.1
color: _returnButtonColor(settingsButton)
Accessible.ignored: true
}

onClicked: {
stackView.push(sv);
}

Accessible.role: Accessible.Button
Accessible.name: Singletons.Strings.settings
Accessible.description: Singletons.Strings.settingsDesc
Accessible.onPressAction: {
if (enabled && visible) {
clicked();
}
}
}

//------------------------------------------------------------------

Button {
id: historyButton
Layout.preferredWidth: toolBarHeight
Layout.fillHeight: true
ToolTip.visible: hovered
ToolTip.text: Singletons.Strings.history

background: Rectangle{
background: Rectangle {
color: toolBarBackground
anchors.fill: parent
}
Expand All @@ -302,23 +340,23 @@ Item {
Accessible.name: Singletons.Strings.exportAndUploadHistory
Accessible.description: Singletons.Strings.exportAndUploadHistoryDesc
Accessible.onPressAction: {
if(enabled && visible){
if (enabled && visible) {
clicked();
}
}
}

//------------------------------------------------------------------

Button{
Button {
id: userButton
Layout.preferredWidth: toolBarHeight
Layout.fillHeight: true
ToolTip.visible: hovered
ToolTip.text: (portal.user !== null && portal.user !== "" && portal.user !== undefined) ? Singletons.Strings.signOut + ": " + portal.user.fullName : "User Unknown"
enabled: true

background: Rectangle{
background: Rectangle {
color: toolBarBackground
anchors.fill: parent
}
Expand All @@ -341,7 +379,7 @@ Item {
Accessible.name: Singletons.Strings.signOut
Accessible.description: Singletons.Strings.signOutDesc
Accessible.onPressAction: {
if(enabled && visible){
if (enabled && visible) {
clicked();
}
}
Expand All @@ -355,7 +393,7 @@ Item {
// SIGNAL IMPLEMENTATIONS //////////////////////////////////////////////////

onUpdateCountChanged: {
if(updateCount > 0){
if (updateCount > 0) {
updatesButtonEnabled = true;
updatesButtonVisible = true;
updateIndicatorVisible = true;
Expand All @@ -365,21 +403,21 @@ Item {

// COMPONENTS //////////////////////////////////////////////////////////////

AboutDialog{
AboutDialog {
id: aboutDialog
}

//--------------------------------------------------------------------------

FeedbackDialog{
FeedbackDialog {
id: feedbackDialog
metrics: mainView.appMetrics
}

// METHODS /////////////////////////////////////////////////////////////////

function _returnButtonColor(cntrl){
if(cntrl.enabled === false){
function _returnButtonColor(cntrl) {
if (cntrl.enabled === false) {
return toolBarButtonDisabledColor;
}
else if(cntrl.hovered){
Expand All @@ -388,7 +426,7 @@ Item {
else if(cntrl.pressed){
return toolBarButtonPressedColor;
}
else{
else {
return toolBarButtonColor;
}
}
Expand Down
20 changes: 16 additions & 4 deletions AvailableServicesInfoRequest.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ Item {
property int tileIndex
property string serviceUrl
property bool useToken: true
property bool useTimeout: false
property int timeoutInterval: 30

signal complete(var data)

onComplete: {
if (timeoutTimer.running) {
timeoutTimer.stop();
}
}

// COMPONENTS //////////////////////////////////////////////////////////////

NetworkRequest {
Expand Down Expand Up @@ -136,7 +144,7 @@ Item {

Timer {
id: timeoutTimer
interval: 10000
//interval: timeoutInterval * 1000
running: false
repeat: false
onTriggered: {
Expand All @@ -151,11 +159,16 @@ Item {

// METHODS /////////////////////////////////////////////////////////////////

function sendRequest(){
function sendRequest() {
serviceRequest.send();
timeoutTimer.start();
if (useTimeout) {
timeoutTimer.interval = timeoutInterval * 1000;
timeoutTimer.start();
}
}

//--------------------------------------------------------------------------

function _exportTilesAllowed(serviceInfo) {

if (serviceInfo.hasOwnProperty("exportTilesAllowed")) {
Expand All @@ -169,7 +182,6 @@ Item {
else {
return false;
}

}

// END /////////////////////////////////////////////////////////////////////
Expand Down
25 changes: 22 additions & 3 deletions AvailableServicesModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Item {
property alias getAvailableServices: tileServicesSearch
property string searchQuery: '(type:"Map Service" AND owner:esri AND title:(for Export)) OR (type:"Map Service" AND owner:' + portal.username + ') OR (type:("Map Service") AND group:(access:org))'
property SqlQueryModel userAddedServices
property bool useTimeout: app.timeoutNonResponsiveServices
property int timeoutInterval: app.timeoutValue

property ListModel servicesListModel: ListModel {
property var tilesToRemove: []
Expand Down Expand Up @@ -95,7 +97,15 @@ Item {
var component = Qt.createComponent("AvailableServicesInfoRequest.qml");

if (component.status === Component.Ready) {
var thisRequest = component.createObject(parent, { portal:availableServicesModel.portal, tileIndex: tileServiceCount, serviceUrl: result.url } );
var thisRequest = component.createObject(parent,
{
portal:availableServicesModel.portal,
tileIndex: tileServiceCount,
serviceUrl: result.url,
useTimeout: availableServicesModel.useTimeout,
timeoutInterval: availableServicesModel.timeoutInterval
}
);
thisRequest.complete.connect(function(serviceData){

if (serviceData.keep === true) {
Expand Down Expand Up @@ -187,7 +197,15 @@ Item {
var component = Qt.createComponent("AvailableServicesInfoRequest.qml");

if (component.status === Component.Ready) {
var thisRequest = component.createObject(parent, { portal:availableServicesModel.portal, tileIndex: servicesListModel.count+1 , serviceUrl: url } );
var thisRequest = component.createObject(parent,
{
portal:availableServicesModel.portal,
tileIndex: servicesListModel.count+1,
serviceUrl: url,
useTimeout: availableServicesModel.useTimeout,
timeoutInterval: availableServicesModel.timeoutInterval
}
);
thisRequest.complete.connect(function(serviceData){

if(serviceData.keep === true){
Expand Down Expand Up @@ -228,7 +246,8 @@ Item {
thisRequest.destroy(2000);
});

thisRequest.send();
thisRequest.sendRequest();
//thisRequest.send();
}
}

Expand Down
Loading

0 comments on commit bd05947

Please sign in to comment.