Skip to content

Commit

Permalink
Use pageNo for page variable as page means something other now in Sai…
Browse files Browse the repository at this point in the history
…lfishOS 4, fixes #29
  • Loading branch information
walokra committed Nov 14, 2021
1 parent 0df7bc5 commit a83ce5a
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions qml/components/imgur.js
Original file line number Diff line number Diff line change
Expand Up @@ -672,29 +672,29 @@ function getAuthorizationHeader() {
}
}

function processGalleryMode(query, model, page, settings, onSuccess, onFailure) {
function processGalleryMode(query, model, pageNo, settings, onSuccess, onFailure) {
// Global accesor used to use the correct URL base for getGalleryImage()
redditModeActive = false;

if (query) {
getGallerySearch(query, model, page, settings, onSuccess, onFailure);
getGallerySearch(query, model, pageNo, settings, onSuccess, onFailure);
}
else if (settings.mode === "main" || settings.mode === "user" || settings.mode === "score") {
getGallery(model, page, settings, onSuccess, onFailure);
getGallery(model, pageNo, settings, onSuccess, onFailure);
} else if (settings.mode === "random") {
getRandomGalleryImages(model, page, onSuccess, onFailure);
getRandomGalleryImages(model, pageNo, onSuccess, onFailure);
} else if (settings.mode === "memes") {
getMemesSubGallery(model, page, settings, onSuccess, onFailure);
getMemesSubGallery(model, pageNo, settings, onSuccess, onFailure);
} else if (settings.mode === "reddit") {
redditModeActive = true;
getRedditSubGallery(model, page, settings, onSuccess, onFailure);
getRedditSubGallery(model, pageNo, settings, onSuccess, onFailure);

} else if (settings.mode === "favorites") {
getFavorites(model, onSuccess, onFailure);
} else if (settings.mode === "albums") {
getAlbums(model, page, onSuccess, onFailure);
getAlbums(model, pageNo, onSuccess, onFailure);
} else if (settings.mode === "images") {
getImages(model, page, onSuccess, onFailure);
getImages(model, pageNo, onSuccess, onFailure);
}
}

2 changes: 1 addition & 1 deletion qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ApplicationWindow {

property Page currentPage: pageStack.currentPage

property int page : 0;
property int pageNo : 0;
property int currentIndex : 0;
property bool loggedIn : false;

Expand Down
2 changes: 1 addition & 1 deletion qml/pages/AccountPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ Page {

function setCommonValues() {
currentIndex = 0;
page = 0;
pageNo = 0;
galleryModel.query = "";
galleryModel.clear();
galleryModel.processGalleryMode();
Expand Down
4 changes: 2 additions & 2 deletions qml/pages/GalleryContentPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Page {

property string galleryContentPageTitle : constant.appName;

property bool prevEnabled: currentIndex > 0 || page > 0;
property bool prevEnabled: currentIndex > 0 || pageNo > 0;

GalleryContentModel {
id: galleryContentModel;
Expand Down Expand Up @@ -77,7 +77,7 @@ Page {
}

function setPrevButton() {
if (currentIndex === 0 && page === 0) {
if (currentIndex === 0 && pageNo === 0) {
prevEnabled = false;
} else {
prevEnabled = true;
Expand Down
2 changes: 1 addition & 1 deletion qml/pages/GalleryMode.qml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ Row {

function setModeCommon() {
settings.saveSetting("mode", settings.mode);
page = 0;
pageNo = 0;
galleryModel.query = "";
toolbar.searchVisible = false;
galgrid.scrollToTop();
Expand Down
2 changes: 1 addition & 1 deletion qml/pages/GalleryModel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ListModel {

signInPage.init();

Imgur.processGalleryMode(query, listModel, page, settings,
Imgur.processGalleryMode(query, listModel, pageNo, settings,
onSuccess(),
onFailure()
);
Expand Down
14 changes: 7 additions & 7 deletions qml/pages/GalleryNavigation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ Item {

z: 2;

visible: galleryModel.count > 1 || page > 0;
visible: galleryModel.count > 1 || pageNo > 0;

function previous() {
//console.log("Previous clicked! curr=" + currentIndex + "; page=" + page);
if (currentIndex > 0 && page >= 0) {
//console.log("Previous clicked! curr=" + currentIndex + "; page=" + pageNo);
if (currentIndex > 0 && pageNo >= 0) {
currentIndex -= 1;
load();
}
if (currentIndex === 0 && page >= 1) {
if (currentIndex === 0 && pageNo >= 1) {
//console.log("Getting previous list of images");
page -= 1;
pageNo -= 1;

loadingRect.visible = true;
galleryModel.clear();
Expand All @@ -36,15 +36,15 @@ Item {
}

function next() {
//console.log("Next clicked! curr=" + currentIndex + "; model=" + galleryModel.count);
//console.log("Next clicked! curr=", + currentIndex + "; count=" + galleryModel.count);
if (currentIndex < galleryModel.count - 1) {
//console.log("Getting next image");
currentIndex += 1;
load();
}
else if (currentIndex === galleryModel.count - 1) {
//console.log("Getting new list of images");
page += 1;
pageNo += 1;
currentIndex = 0;

loadingRect.visible = true;
Expand Down
4 changes: 2 additions & 2 deletions qml/pages/MainPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ Page {

// if (page > 0) {
// page -= 1;
// console.log("atYBeginning: " + page);
// console.log("atYBeginning: " + pageNo);
// statusLabel.text = qsTr("Loading previous page");
// galleryModel.prevPage(galleryModel.query);
// galgrid.scrollToBottom();
Expand All @@ -226,7 +226,7 @@ Page {

if(atYEnd) {
page += 1;
// console.log("atYEnd: " + page);
// console.log("atYEnd: " + pageNo);
statusLabel.text = qsTr("Loading next page");
galleryModel.nextPage(galleryModel.query);
}
Expand Down
2 changes: 1 addition & 1 deletion qml/pages/Toolbar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Column {
settings.saveSetting("mode", settings.mode);
modeChanged("main");

page = 0;
pageNo = 0;
galleryModel.query = "";
searchPanel.visible = false;
galgrid.scrollToTop();
Expand Down

0 comments on commit a83ce5a

Please sign in to comment.