a little code refactoring

This commit is contained in:
Hauke Schade 2013-07-09 20:43:56 +02:00
parent 8a3f02d982
commit 7cace26d10
26 changed files with 33 additions and 27 deletions

View file

@ -12,6 +12,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import QtWebKit 1.0
import "../components" 1.0
Page {
tools: aboutTools

View file

@ -11,6 +11,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import "../components" 1.0
Page {
id: categoriesPage
@ -53,11 +54,10 @@ Page {
function showCategory(catId, title) {
if(catId != null) {
var component = Qt.createComponent("Feeds.qml");
if (component.status === Component.Ready)
pageStack.push(component, { categoryId: catId, pageTitle: title });
else
console.log("Error loading component:", component.errorString());
rootWindow.openFile("Feeds.qml", {
categoryId: catId,
pageTitle: title
})
}
}

View file

@ -11,6 +11,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import "../components" 1.0
Item {
id: root

View file

@ -11,6 +11,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import "../components" 1.0
Item {
id: root

View file

@ -12,6 +12,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import QtWebKit 1.0
import "../components" 1.0
Page {
id: itemPage

View file

@ -11,6 +11,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import "../components" 1.0
Page {
id: itemListPage
@ -67,15 +68,11 @@ Page {
function showFeedItem(articleId, feedId, title) {
if(articleId != null && feedId != null) {
var component = Qt.createComponent("FeedItem.qml");
if (component.status === Component.Ready)
pageStack.push(component, {
articleId: articleId,
feedId: feedId,
pageTitle: title
});
else
console.log("Error loading component:", component.errorString());
rootWindow.openFile("FeedItem.qml", {
articleId: articleId,
feedId: feedId,
pageTitle: title
})
}
}

View file

@ -11,6 +11,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import "../components" 1.0
Page {
id: feedsPage
@ -129,15 +130,11 @@ Page {
function showFeed(feedId, title, pageLogo) {
if(feedId != null) {
var component = Qt.createComponent("FeedItems.qml");
if (component.status === Component.Ready)
pageStack.push(component, {
feedId: feedId,
pageTitle: title,
pageLogo: pageLogo
});
else
console.log("Error loading component:", component.errorString());
rootWindow.openFile("FeedItems.qml", {
feedId: feedId,
pageTitle: title,
pageLogo: pageLogo
})
}
}

View file

@ -11,6 +11,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import "../components" 1.0
Page {
property bool loading: false

View file

@ -11,6 +11,7 @@
import QtQuick 1.1
import com.nokia.meego 1.0
import "../components" 1.0
Page {
id: settingsPage

View file

@ -17,10 +17,14 @@ import "tinytinyrss.js" as TTRss
PageStackWindow {
id: rootWindow
function openFile(file) {
function openFile(file, params) {
var component = Qt.createComponent(file)
if (component.status === Component.Ready)
pageStack.push(component);
if (component.status === Component.Ready) {
if (params !== undefined)
pageStack.push(component, params);
else
pageStack.push(component);
}
else
console.log("Error loading component:", component.errorString());
}

View file

@ -4,7 +4,9 @@ DEFINES += APP_VERSION=\\\"$$VERSION\\\"
# Add more folders to ship with the application, here
folder_01.source = qml/ttrss
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01
folder_02.source = qml/components
folder_02.target = qml
DEPLOYMENTFOLDERS = folder_01 folder_02
# Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =