Add switchable Debug output (JS)
This commit is contained in:
parent
10af41eb83
commit
7017818acb
15 changed files with 177 additions and 61 deletions
|
@ -64,6 +64,7 @@ DISTFILES += qml/harbour-fernschreiber.qml \
|
||||||
qml/components/chatInformationPage/ChatInformationTextItem.qml \
|
qml/components/chatInformationPage/ChatInformationTextItem.qml \
|
||||||
qml/components/chatInformationPage/EditGroupChatPermissionsColumn.qml \
|
qml/components/chatInformationPage/EditGroupChatPermissionsColumn.qml \
|
||||||
qml/components/chatInformationPage/EditSuperGroupSlowModeColumn.qml \
|
qml/components/chatInformationPage/EditSuperGroupSlowModeColumn.qml \
|
||||||
|
qml/js/debug.js \
|
||||||
qml/js/functions.js \
|
qml/js/functions.js \
|
||||||
qml/pages/ChatInformationPage.qml \
|
qml/pages/ChatInformationPage.qml \
|
||||||
qml/pages/ChatPage.qml \
|
qml/pages/ChatPage.qml \
|
||||||
|
@ -146,6 +147,7 @@ HEADERS += \
|
||||||
src/dbusadaptor.h \
|
src/dbusadaptor.h \
|
||||||
src/dbusinterface.h \
|
src/dbusinterface.h \
|
||||||
src/debuglog.h \
|
src/debuglog.h \
|
||||||
|
src/debuglogjs.h \
|
||||||
src/emojisearchworker.h \
|
src/emojisearchworker.h \
|
||||||
src/fernschreiberutils.h \
|
src/fernschreiberutils.h \
|
||||||
src/notificationmanager.h \
|
src/notificationmanager.h \
|
||||||
|
|
|
@ -20,6 +20,8 @@ import QtQuick 2.6
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import QtMultimedia 5.6
|
import QtMultimedia 5.6
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: audioMessageComponent
|
id: audioMessageComponent
|
||||||
|
@ -249,39 +251,39 @@ Item {
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status == MediaPlayer.NoMedia) {
|
if (status == MediaPlayer.NoMedia) {
|
||||||
console.log("No Media");
|
Debug.log("No Media");
|
||||||
audioBusyIndicator.visible = false;
|
audioBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Loading) {
|
if (status == MediaPlayer.Loading) {
|
||||||
console.log("Loading");
|
Debug.log("Loading");
|
||||||
audioBusyIndicator.visible = true;
|
audioBusyIndicator.visible = true;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Loaded) {
|
if (status == MediaPlayer.Loaded) {
|
||||||
console.log("Loaded");
|
Debug.log("Loaded");
|
||||||
audioBusyIndicator.visible = false;
|
audioBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Buffering) {
|
if (status == MediaPlayer.Buffering) {
|
||||||
console.log("Buffering");
|
Debug.log("Buffering");
|
||||||
audioBusyIndicator.visible = true;
|
audioBusyIndicator.visible = true;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Stalled) {
|
if (status == MediaPlayer.Stalled) {
|
||||||
console.log("Stalled");
|
Debug.log("Stalled");
|
||||||
audioBusyIndicator.visible = true;
|
audioBusyIndicator.visible = true;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Buffered) {
|
if (status == MediaPlayer.Buffered) {
|
||||||
console.log("Buffered");
|
Debug.log("Buffered");
|
||||||
audioBusyIndicator.visible = false;
|
audioBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.EndOfMedia) {
|
if (status == MediaPlayer.EndOfMedia) {
|
||||||
console.log("End of Media");
|
Debug.log("End of Media");
|
||||||
audioBusyIndicator.visible = false;
|
audioBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.InvalidMedia) {
|
if (status == MediaPlayer.InvalidMedia) {
|
||||||
console.log("Invalid Media");
|
Debug.log("Invalid Media");
|
||||||
audioBusyIndicator.visible = false;
|
audioBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.UnknownStatus) {
|
if (status == MediaPlayer.UnknownStatus) {
|
||||||
console.log("Unknown Status");
|
Debug.log("Unknown Status");
|
||||||
audioBusyIndicator.visible = false;
|
audioBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import Sailfish.Silica 1.0
|
||||||
import "../js/twemoji.js" as Emoji
|
import "../js/twemoji.js" as Emoji
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
import QtQml.Models 2.3
|
import QtQml.Models 2.3
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
|
|
||||||
ListItem {
|
ListItem {
|
||||||
id: messageListItem
|
id: messageListItem
|
||||||
|
@ -136,12 +137,12 @@ ListItem {
|
||||||
messageBackground.isUnread = index > chatModel.getLastReadMessageIndex();
|
messageBackground.isUnread = index > chatModel.getLastReadMessageIndex();
|
||||||
}
|
}
|
||||||
onLastReadSentMessageUpdated: {
|
onLastReadSentMessageUpdated: {
|
||||||
console.log("[ChatModel] Messages in this chat were read, new last read: " + lastReadSentIndex + ", updating description for index " + index + ", status: " + (index <= lastReadSentIndex));
|
Debug.log("[ChatModel] Messages in this chat were read, new last read: ", lastReadSentIndex, ", updating description for index ", index, ", status: ", (index <= lastReadSentIndex));
|
||||||
messageDateText.text = getMessageStatusText(myMessage, index, lastReadSentIndex, messageDateText.useElapsed);
|
messageDateText.text = getMessageStatusText(myMessage, index, lastReadSentIndex, messageDateText.useElapsed);
|
||||||
}
|
}
|
||||||
onMessageUpdated: {
|
onMessageUpdated: {
|
||||||
if (index === modelIndex) {
|
if (index === modelIndex) {
|
||||||
console.log("[ChatModel] This message was updated, index " + index + ", updating content...");
|
Debug.log("[ChatModel] This message was updated, index ", index, ", updating content...");
|
||||||
messageDateText.text = getMessageStatusText(myMessage, index, chatView.lastReadSentIndex, messageDateText.useElapsed);
|
messageDateText.text = getMessageStatusText(myMessage, index, chatView.lastReadSentIndex, messageDateText.useElapsed);
|
||||||
messageText.text = Emoji.emojify(Functions.getMessageText(myMessage, false, messageListItem.isOwnMessage), messageText.font.pixelSize);
|
messageText.text = Emoji.emojify(Functions.getMessageText(myMessage, false, messageListItem.isOwnMessage), messageText.font.pixelSize);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import Sailfish.Silica 1.0
|
||||||
import "../components"
|
import "../components"
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
import "../js/twemoji.js" as Emoji
|
import "../js/twemoji.js" as Emoji
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: pinnedMessageItem
|
id: pinnedMessageItem
|
||||||
|
@ -31,7 +32,7 @@ Item {
|
||||||
|
|
||||||
onPinnedMessageChanged: {
|
onPinnedMessageChanged: {
|
||||||
if (pinnedMessage) {
|
if (pinnedMessage) {
|
||||||
console.log("[ChatPage] Activating pinned message");
|
Debug.log("[ChatPage] Activating pinned message");
|
||||||
var messageUserText = (pinnedMessage.sender_user_id !== chatPage.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(pinnedMessage.sender_user_id)), pinnedMessageUserText.font.pixelSize) : qsTr("You");
|
var messageUserText = (pinnedMessage.sender_user_id !== chatPage.myUserId) ? Emoji.emojify(Functions.getUserName(tdLibWrapper.getUserInformation(pinnedMessage.sender_user_id)), pinnedMessageUserText.font.pixelSize) : qsTr("You");
|
||||||
pinnedMessageUserText.text = (messageUserText === "" ? qsTr("Pinned Message") : messageUserText );
|
pinnedMessageUserText.text = (messageUserText === "" ? qsTr("Pinned Message") : messageUserText );
|
||||||
pinnedMessageText.text = Emoji.emojify(Functions.getMessageText(pinnedMessage, true, pinnedMessage.sender_user_id === chatPage.myUserId), pinnedMessageText.font.pixelSize);
|
pinnedMessageText.text = Emoji.emojify(Functions.getMessageText(pinnedMessage, true, pinnedMessage.sender_user_id === chatPage.myUserId), pinnedMessageText.font.pixelSize);
|
||||||
|
|
|
@ -20,6 +20,7 @@ import QtQuick 2.6
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import QtMultimedia 5.6
|
import QtMultimedia 5.6
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: videoMessageComponent
|
id: videoMessageComponent
|
||||||
|
@ -302,39 +303,39 @@ Item {
|
||||||
|
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
if (status == MediaPlayer.NoMedia) {
|
if (status == MediaPlayer.NoMedia) {
|
||||||
console.log("No Media");
|
Debug.log("No Media");
|
||||||
videoBusyIndicator.visible = false;
|
videoBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Loading) {
|
if (status == MediaPlayer.Loading) {
|
||||||
console.log("Loading");
|
Debug.log("Loading");
|
||||||
videoBusyIndicator.visible = true;
|
videoBusyIndicator.visible = true;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Loaded) {
|
if (status == MediaPlayer.Loaded) {
|
||||||
console.log("Loaded");
|
Debug.log("Loaded");
|
||||||
videoBusyIndicator.visible = false;
|
videoBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Buffering) {
|
if (status == MediaPlayer.Buffering) {
|
||||||
console.log("Buffering");
|
Debug.log("Buffering");
|
||||||
videoBusyIndicator.visible = true;
|
videoBusyIndicator.visible = true;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Stalled) {
|
if (status == MediaPlayer.Stalled) {
|
||||||
console.log("Stalled");
|
Debug.log("Stalled");
|
||||||
videoBusyIndicator.visible = true;
|
videoBusyIndicator.visible = true;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.Buffered) {
|
if (status == MediaPlayer.Buffered) {
|
||||||
console.log("Buffered");
|
Debug.log("Buffered");
|
||||||
videoBusyIndicator.visible = false;
|
videoBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.EndOfMedia) {
|
if (status == MediaPlayer.EndOfMedia) {
|
||||||
console.log("End of Media");
|
Debug.log("End of Media");
|
||||||
videoBusyIndicator.visible = false;
|
videoBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.InvalidMedia) {
|
if (status == MediaPlayer.InvalidMedia) {
|
||||||
console.log("Invalid Media");
|
Debug.log("Invalid Media");
|
||||||
videoBusyIndicator.visible = false;
|
videoBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
if (status == MediaPlayer.UnknownStatus) {
|
if (status == MediaPlayer.UnknownStatus) {
|
||||||
console.log("Unknown Status");
|
Debug.log("Unknown Status");
|
||||||
videoBusyIndicator.visible = false;
|
videoBusyIndicator.visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import Sailfish.Silica 1.0
|
||||||
import "../"
|
import "../"
|
||||||
import "../../js/twemoji.js" as Emoji
|
import "../../js/twemoji.js" as Emoji
|
||||||
import "../../js/functions.js" as Functions
|
import "../../js/functions.js" as Functions
|
||||||
|
import "../../js/debug.js" as Debug
|
||||||
|
|
||||||
|
|
||||||
SilicaFlickable {
|
SilicaFlickable {
|
||||||
|
@ -59,7 +60,7 @@ SilicaFlickable {
|
||||||
chatInformationPage.isChannel = chatInformationPage.groupInformation.is_channel;
|
chatInformationPage.isChannel = chatInformationPage.groupInformation.is_channel;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
console.log("is set up", chatInformationPage.isPrivateChat, chatInformationPage.isBasicGroup, chatInformationPage.isSuperGroup, chatInformationPage.chatPartnerGroupId)
|
Debug.log("is set up", chatInformationPage.isPrivateChat, chatInformationPage.isBasicGroup, chatInformationPage.isSuperGroup, chatInformationPage.chatPartnerGroupId)
|
||||||
if(!chatInformationPage.isPrivateChat) {
|
if(!chatInformationPage.isPrivateChat) {
|
||||||
updateGroupStatusText();
|
updateGroupStatusText();
|
||||||
}
|
}
|
||||||
|
@ -123,13 +124,13 @@ SilicaFlickable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onSupergroupFullInfoReceived: {
|
onSupergroupFullInfoReceived: {
|
||||||
console.log("onSupergroupFullInfoReceived", chatInformationPage.isSuperGroup, chatInformationPage.chatPartnerGroupId, groupId)
|
Debug.log("onSupergroupFullInfoReceived", chatInformationPage.isSuperGroup, chatInformationPage.chatPartnerGroupId, groupId)
|
||||||
if(chatInformationPage.isSuperGroup && chatInformationPage.chatPartnerGroupId === groupId) {
|
if(chatInformationPage.isSuperGroup && chatInformationPage.chatPartnerGroupId === groupId) {
|
||||||
chatInformationPage.groupFullInformation = groupFullInfo;
|
chatInformationPage.groupFullInformation = groupFullInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onSupergroupFullInfoUpdated: {
|
onSupergroupFullInfoUpdated: {
|
||||||
console.log("onSupergroupFullInfoUpdated", chatInformationPage.isSuperGroup, chatInformationPage.chatPartnerGroupId, groupId)
|
Debug.log("onSupergroupFullInfoUpdated", chatInformationPage.isSuperGroup, chatInformationPage.chatPartnerGroupId, groupId)
|
||||||
if(chatInformationPage.isSuperGroup && chatInformationPage.chatPartnerGroupId === groupId) {
|
if(chatInformationPage.isSuperGroup && chatInformationPage.chatPartnerGroupId === groupId) {
|
||||||
chatInformationPage.groupFullInformation = groupFullInfo;
|
chatInformationPage.groupFullInformation = groupFullInfo;
|
||||||
}
|
}
|
||||||
|
|
47
qml/js/debug.js
Normal file
47
qml/js/debug.js
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2020 Sebastian J. Wolf and other contributors
|
||||||
|
|
||||||
|
This file is part of Fernschreiber.
|
||||||
|
|
||||||
|
Fernschreiber is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Fernschreiber is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
.pragma library
|
||||||
|
.import WerkWolf.Fernschreiber 1.0 as Fernschreiber
|
||||||
|
var enabled = Fernschreiber.DebugLog.enabled;
|
||||||
|
var log = enabled ? console.log : function(){};
|
||||||
|
var assert = enabled ? console.assert : function(){};
|
||||||
|
var time = enabled ? console.time : function(){};
|
||||||
|
var timeEnd = enabled ? console.timeEnd : function(){};
|
||||||
|
var trace = enabled ? console.trace : function(){};
|
||||||
|
var count = enabled ? console.count : function(){};
|
||||||
|
var profile = enabled ? console.profile : function(){};
|
||||||
|
var exception = enabled ? console.exception : function(){};
|
||||||
|
|
||||||
|
Fernschreiber.DebugLog.enabledChanged.connect(function(isEnabled) {
|
||||||
|
enabled = isEnabled;
|
||||||
|
if(isEnabled) {
|
||||||
|
log = console.log;
|
||||||
|
assert = console.assert;
|
||||||
|
time = console.time;
|
||||||
|
timeEnd = console.timeEnd;
|
||||||
|
trace = console.trace;
|
||||||
|
count = console.count;
|
||||||
|
profile = console.profile;
|
||||||
|
exception = console.exception;
|
||||||
|
} else {
|
||||||
|
log = assert = time = timeEnd = trace = count = profile = exception = function(){};
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
|
@ -17,6 +17,10 @@
|
||||||
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
.pragma library
|
||||||
|
.import "debug.js" as Debug
|
||||||
|
.import Sailfish.Silica 1.0 as Silica
|
||||||
|
|
||||||
function getUserName(userInformation) {
|
function getUserName(userInformation) {
|
||||||
var firstName = typeof userInformation.first_name !== "undefined" ? userInformation.first_name : "";
|
var firstName = typeof userInformation.first_name !== "undefined" ? userInformation.first_name : "";
|
||||||
var lastName = typeof userInformation.last_name !== "undefined" ? userInformation.last_name : "";
|
var lastName = typeof userInformation.last_name !== "undefined" ? userInformation.last_name : "";
|
||||||
|
@ -194,7 +198,7 @@ function getShortenedCount(count) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDateTimeElapsed(timestamp) {
|
function getDateTimeElapsed(timestamp) {
|
||||||
return Format.formatDate(new Date(timestamp * 1000), Formatter.DurationElapsed);
|
return Silica.Format.formatDate(new Date(timestamp * 1000), Silica.Formatter.DurationElapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDateTimeTranslated(timestamp) {
|
function getDateTimeTranslated(timestamp) {
|
||||||
|
@ -344,7 +348,7 @@ function handleLink(link) {
|
||||||
} else if (link.indexOf("userId://") === 0) {
|
} else if (link.indexOf("userId://") === 0) {
|
||||||
tdLibWrapper.createPrivateChat(link.substring(9));
|
tdLibWrapper.createPrivateChat(link.substring(9));
|
||||||
} else if (link.indexOf("tg://") === 0) {
|
} else if (link.indexOf("tg://") === 0) {
|
||||||
console.log("Special TG link: " + link);
|
Debug.log("Special TG link: ", link);
|
||||||
if (link.indexOf("tg://join?invite=") === 0) {
|
if (link.indexOf("tg://join?invite=") === 0) {
|
||||||
tdLibWrapper.joinChatByInviteLink(tMePrefix + "joinchat/" + link.substring(17));
|
tdLibWrapper.joinChatByInviteLink(tMePrefix + "joinchat/" + link.substring(17));
|
||||||
} else if (link.indexOf("tg://resolve?domain=") === 0) {
|
} else if (link.indexOf("tg://resolve?domain=") === 0) {
|
||||||
|
@ -353,12 +357,12 @@ function handleLink(link) {
|
||||||
} else {
|
} else {
|
||||||
if (link.indexOf(tMePrefix) === 0) {
|
if (link.indexOf(tMePrefix) === 0) {
|
||||||
if (link.indexOf("joinchat") !== -1) {
|
if (link.indexOf("joinchat") !== -1) {
|
||||||
console.log("Joining Chat: " + link);
|
Debug.log("Joining Chat: ", link);
|
||||||
tdLibWrapper.joinChatByInviteLink(link);
|
tdLibWrapper.joinChatByInviteLink(link);
|
||||||
// Do the necessary stuff to open the chat if successful
|
// Do the necessary stuff to open the chat if successful
|
||||||
// Fail with nice error message if it doesn't work
|
// Fail with nice error message if it doesn't work
|
||||||
} else {
|
} else {
|
||||||
console.log("Search public chat: " + link.substring(tMePrefix.length));
|
Debug.log("Search public chat: ", link.substring(tMePrefix.length));
|
||||||
tdLibWrapper.searchPublicChat(link.substring(tMePrefix.length));
|
tdLibWrapper.searchPublicChat(link.substring(tMePrefix.length));
|
||||||
// Check responses for updateBasicGroup or updateSupergroup
|
// Check responses for updateBasicGroup or updateSupergroup
|
||||||
// Fire createBasicGroupChat or createSupergroupChat
|
// Fire createBasicGroupChat or createSupergroupChat
|
||||||
|
|
|
@ -22,6 +22,7 @@ import "../components"
|
||||||
import "../components/chatInformationPage"
|
import "../components/chatInformationPage"
|
||||||
import "../js/twemoji.js" as Emoji
|
import "../js/twemoji.js" as Emoji
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
id: chatInformationPage
|
id: chatInformationPage
|
||||||
|
@ -59,7 +60,7 @@ Page {
|
||||||
onStatusChanged: {
|
onStatusChanged: {
|
||||||
switch(status) {
|
switch(status) {
|
||||||
case PageStatus.Activating:
|
case PageStatus.Activating:
|
||||||
console.log("activating Loader")
|
Debug.log("activating Loader")
|
||||||
mainContentLoader.active = true
|
mainContentLoader.active = true
|
||||||
break;
|
break;
|
||||||
case PageStatus.Active:
|
case PageStatus.Active:
|
||||||
|
|
|
@ -23,6 +23,7 @@ import Sailfish.Pickers 1.0
|
||||||
import Nemo.Thumbnailer 1.0
|
import Nemo.Thumbnailer 1.0
|
||||||
import WerkWolf.Fernschreiber 1.0
|
import WerkWolf.Fernschreiber 1.0
|
||||||
import "../components"
|
import "../components"
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
import "../js/twemoji.js" as Emoji
|
import "../js/twemoji.js" as Emoji
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
|
|
||||||
|
@ -133,7 +134,7 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializePage() {
|
function initializePage() {
|
||||||
console.log("[ChatPage] Initializing chat page...");
|
Debug.log("[ChatPage] Initializing chat page...");
|
||||||
chatView.currentIndex = -1;
|
chatView.currentIndex = -1;
|
||||||
chatView.lastReadSentIndex = 0;
|
chatView.lastReadSentIndex = 0;
|
||||||
var chatType = chatInformation.type['@type'];
|
var chatType = chatInformation.type['@type'];
|
||||||
|
@ -154,13 +155,13 @@ Page {
|
||||||
updateGroupStatusText();
|
updateGroupStatusText();
|
||||||
}
|
}
|
||||||
if (stickerManager.needsReload()) {
|
if (stickerManager.needsReload()) {
|
||||||
console.log("[ChatPage] Stickers will be reloaded!");
|
Debug.log("[ChatPage] Stickers will be reloaded!");
|
||||||
tdLibWrapper.getRecentStickers();
|
tdLibWrapper.getRecentStickers();
|
||||||
tdLibWrapper.getInstalledStickerSets();
|
tdLibWrapper.getInstalledStickerSets();
|
||||||
stickerManager.setNeedsReload(false);
|
stickerManager.setNeedsReload(false);
|
||||||
}
|
}
|
||||||
if (chatInformation.pinned_message_id.toString() !== "0") {
|
if (chatInformation.pinned_message_id.toString() !== "0") {
|
||||||
console.log("[ChatPage] Loading pinned message " + chatInformation.pinned_message_id);
|
Debug.log("[ChatPage] Loading pinned message ", chatInformation.pinned_message_id);
|
||||||
tdLibWrapper.getMessage(chatInformation.id, chatInformation.pinned_message_id);
|
tdLibWrapper.getMessage(chatInformation.id, chatInformation.pinned_message_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,28 +293,28 @@ Page {
|
||||||
|| (groupStatusType === "chatMemberStatusRestricted" && groupStatus.permissions[privilege])
|
|| (groupStatusType === "chatMemberStatusRestricted" && groupStatus.permissions[privilege])
|
||||||
}
|
}
|
||||||
function canPinMessages() {
|
function canPinMessages() {
|
||||||
console.log("Can we pin messages?");
|
Debug.log("Can we pin messages?");
|
||||||
if (chatPage.isPrivateChat) {
|
if (chatPage.isPrivateChat) {
|
||||||
console.log("Private Chat: No!");
|
Debug.log("Private Chat: No!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusCreator") {
|
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusCreator") {
|
||||||
console.log("Creator of this chat: Yes!");
|
Debug.log("Creator of this chat: Yes!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (chatPage.chatInformation.permissions.can_pin_messages) {
|
if (chatPage.chatInformation.permissions.can_pin_messages) {
|
||||||
console.log("All people can pin: Yes!");
|
Debug.log("All people can pin: Yes!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusAdministrator") {
|
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusAdministrator") {
|
||||||
console.log("Admin with privileges? " + chatPage.chatGroupInformation.status.can_pin_messages);
|
Debug.log("Admin with privileges? ", chatPage.chatGroupInformation.status.can_pin_messages);
|
||||||
return chatPage.chatGroupInformation.status.can_pin_messages;
|
return chatPage.chatGroupInformation.status.can_pin_messages;
|
||||||
}
|
}
|
||||||
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusRestricted") {
|
if (chatPage.chatGroupInformation.status["@type"] === "chatMemberStatusRestricted") {
|
||||||
console.log("Restricted, but can pin messages? " + chatPage.chatGroupInformation.status.permissions.can_pin_messages);
|
Debug.log("Restricted, but can pin messages? ", chatPage.chatGroupInformation.status.permissions.can_pin_messages);
|
||||||
return chatPage.chatGroupInformation.status.permissions.can_pin_messages;
|
return chatPage.chatGroupInformation.status.permissions.can_pin_messages;
|
||||||
}
|
}
|
||||||
console.log("Something else: No!");
|
Debug.log("Something else: No!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,7 +385,7 @@ Page {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onChatOnlineMemberCountUpdated: {
|
onChatOnlineMemberCountUpdated: {
|
||||||
console.log(isSuperGroup + "/" + isBasicGroup + "/" + chatInformation.id.toString() + "/" + chatId);
|
Debug.log(isSuperGroup, "/", isBasicGroup, "/", chatInformation.id.toString(), "/", chatId);
|
||||||
if ((isSuperGroup || isBasicGroup) && chatInformation.id.toString() === chatId) {
|
if ((isSuperGroup || isBasicGroup) && chatInformation.id.toString() === chatId) {
|
||||||
chatOnlineMemberCount = onlineMemberCount;
|
chatOnlineMemberCount = onlineMemberCount;
|
||||||
updateGroupStatusText();
|
updateGroupStatusText();
|
||||||
|
@ -405,7 +406,7 @@ Page {
|
||||||
}
|
}
|
||||||
onReceivedMessage: {
|
onReceivedMessage: {
|
||||||
if (messageId === chatInformation.pinned_message_id.toString()) {
|
if (messageId === chatInformation.pinned_message_id.toString()) {
|
||||||
console.log("[ChatPage] Received pinned message");
|
Debug.log("[ChatPage] Received pinned message");
|
||||||
pinnedMessageItem.pinnedMessage = message;
|
pinnedMessageItem.pinnedMessage = message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,11 +415,11 @@ Page {
|
||||||
Connections {
|
Connections {
|
||||||
target: chatModel
|
target: chatModel
|
||||||
onMessagesReceived: {
|
onMessagesReceived: {
|
||||||
console.log("[ChatPage] Messages received, view has " + chatView.count + " messages, setting view to index " + modelIndex + ", own messages were read before index " + lastReadSentIndex);
|
Debug.log("[ChatPage] Messages received, view has ", chatView.count, " messages, setting view to index ", modelIndex, ", own messages were read before index ", lastReadSentIndex);
|
||||||
if (totalCount === 0) {
|
if (totalCount === 0) {
|
||||||
if (chatPage.iterativeInitialization) {
|
if (chatPage.iterativeInitialization) {
|
||||||
chatPage.iterativeInitialization = false;
|
chatPage.iterativeInitialization = false;
|
||||||
console.log("[ChatPage] actually, skipping that: No Messages in Chat.");
|
Debug.log("[ChatPage] actually, skipping that: No Messages in Chat.");
|
||||||
chatView.positionViewAtEnd();
|
chatView.positionViewAtEnd();
|
||||||
chatPage.loading = false;
|
chatPage.loading = false;
|
||||||
return;
|
return;
|
||||||
|
@ -436,28 +437,28 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatView.height > chatView.contentHeight) {
|
if (chatView.height > chatView.contentHeight) {
|
||||||
console.log("[ChatPage] Chat content quite small...");
|
Debug.log("[ChatPage] Chat content quite small...");
|
||||||
viewMessageTimer.queueViewMessage(chatView.count - 1);
|
viewMessageTimer.queueViewMessage(chatView.count - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onNewMessageReceived: {
|
onNewMessageReceived: {
|
||||||
if (chatView.manuallyScrolledToBottom || message.sender_user_id === chatPage.myUserId) {
|
if (chatView.manuallyScrolledToBottom || message.sender_user_id === chatPage.myUserId) {
|
||||||
console.log("[ChatPage] Own message received or was scrolled to bottom, scrolling down to see it...");
|
Debug.log("[ChatPage] Own message received or was scrolled to bottom, scrolling down to see it...");
|
||||||
chatView.scrollToIndex(chatView.count - 1);
|
chatView.scrollToIndex(chatView.count - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onUnreadCountUpdated: {
|
onUnreadCountUpdated: {
|
||||||
console.log("[ChatPage] Unread count updated, new count: " + unreadCount);
|
Debug.log("[ChatPage] Unread count updated, new count: ", unreadCount);
|
||||||
chatInformation.unread_count = unreadCount;
|
chatInformation.unread_count = unreadCount;
|
||||||
chatUnreadMessagesCountBackground.visible = ( !chatPage.loading && unreadCount > 0 );
|
chatUnreadMessagesCountBackground.visible = ( !chatPage.loading && unreadCount > 0 );
|
||||||
chatUnreadMessagesCount.text = unreadCount > 99 ? "99+" : unreadCount;
|
chatUnreadMessagesCount.text = unreadCount > 99 ? "99+" : unreadCount;
|
||||||
}
|
}
|
||||||
onLastReadSentMessageUpdated: {
|
onLastReadSentMessageUpdated: {
|
||||||
console.log("[ChatPage] Updating last read sent index, new index: " + lastReadSentIndex);
|
Debug.log("[ChatPage] Updating last read sent index, new index: ", lastReadSentIndex);
|
||||||
chatView.lastReadSentIndex = lastReadSentIndex;
|
chatView.lastReadSentIndex = lastReadSentIndex;
|
||||||
}
|
}
|
||||||
onMessagesIncrementalUpdate: {
|
onMessagesIncrementalUpdate: {
|
||||||
console.log("Incremental update received. View now has " + chatView.count + " messages, view is on index " + modelIndex + ", own messages were read before index " + lastReadSentIndex);
|
Debug.log("Incremental update received. View now has ", chatView.count, " messages, view is on index ", modelIndex, ", own messages were read before index ", lastReadSentIndex);
|
||||||
chatView.lastReadSentIndex = lastReadSentIndex;
|
chatView.lastReadSentIndex = lastReadSentIndex;
|
||||||
chatViewCooldownTimer.start();
|
chatViewCooldownTimer.start();
|
||||||
}
|
}
|
||||||
|
@ -468,7 +469,7 @@ Page {
|
||||||
onPinnedMessageChanged: {
|
onPinnedMessageChanged: {
|
||||||
chatInformation = chatModel.getChatInformation();
|
chatInformation = chatModel.getChatInformation();
|
||||||
if (chatInformation.pinned_message_id.toString() !== "0") {
|
if (chatInformation.pinned_message_id.toString() !== "0") {
|
||||||
console.log("[ChatPage] Loading pinned message " + chatInformation.pinned_message_id);
|
Debug.log("[ChatPage] Loading pinned message ", chatInformation.pinned_message_id);
|
||||||
tdLibWrapper.getMessage(chatInformation.id, chatInformation.pinned_message_id);
|
tdLibWrapper.getMessage(chatInformation.id, chatInformation.pinned_message_id);
|
||||||
} else {
|
} else {
|
||||||
pinnedMessageItem.pinnedMessage = undefined;
|
pinnedMessageItem.pinnedMessage = undefined;
|
||||||
|
@ -697,7 +698,7 @@ Page {
|
||||||
repeat: false
|
repeat: false
|
||||||
running: false
|
running: false
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
console.log("[ChatPage] Cooldown completed...");
|
Debug.log("[ChatPage] Cooldown completed...");
|
||||||
chatView.inCooldown = false;
|
chatView.inCooldown = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -747,7 +748,7 @@ Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleScrollPositionChanged() {
|
function handleScrollPositionChanged() {
|
||||||
console.log("Current position: " + chatView.contentY);
|
Debug.log("Current position: ", chatView.contentY);
|
||||||
if (chatInformation.unread_count > 0) {
|
if (chatInformation.unread_count > 0) {
|
||||||
var bottomIndex = chatView.indexAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin ));
|
var bottomIndex = chatView.indexAt(chatView.contentX, ( chatView.contentY + chatView.height - Theme.horizontalPageMargin ));
|
||||||
if (bottomIndex > -1) {
|
if (bottomIndex > -1) {
|
||||||
|
@ -770,11 +771,11 @@ Page {
|
||||||
onContentYChanged: {
|
onContentYChanged: {
|
||||||
if (!chatPage.loading && !chatView.inCooldown) {
|
if (!chatPage.loading && !chatView.inCooldown) {
|
||||||
if (chatView.indexAt(chatView.contentX, chatView.contentY) < 10) {
|
if (chatView.indexAt(chatView.contentX, chatView.contentY) < 10) {
|
||||||
console.log("[ChatPage] Trying to get older history items...");
|
Debug.log("[ChatPage] Trying to get older history items...");
|
||||||
chatView.inCooldown = true;
|
chatView.inCooldown = true;
|
||||||
chatModel.triggerLoadMoreHistory();
|
chatModel.triggerLoadMoreHistory();
|
||||||
} else if (chatView.indexAt(chatView.contentX, chatView.contentY) > ( count - 10)) {
|
} else if (chatView.indexAt(chatView.contentX, chatView.contentY) > ( count - 10)) {
|
||||||
console.log("[ChatPage] Trying to get newer history items...");
|
Debug.log("[ChatPage] Trying to get newer history items...");
|
||||||
chatView.inCooldown = true;
|
chatView.inCooldown = true;
|
||||||
chatModel.triggerLoadMoreFuture();
|
chatModel.triggerLoadMoreFuture();
|
||||||
}
|
}
|
||||||
|
@ -999,7 +1000,7 @@ Page {
|
||||||
var picker = pageStack.push("Sailfish.Pickers.ImagePickerPage");
|
var picker = pageStack.push("Sailfish.Pickers.ImagePickerPage");
|
||||||
picker.selectedContentPropertiesChanged.connect(function(){
|
picker.selectedContentPropertiesChanged.connect(function(){
|
||||||
attachmentOptionsRow.visible = false;
|
attachmentOptionsRow.visible = false;
|
||||||
console.log("Selected document: " + picker.selectedContentProperties.filePath );
|
Debug.log("Selected document: ", picker.selectedContentProperties.filePath );
|
||||||
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
|
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
|
||||||
attachmentPreviewRow.isPicture = true;
|
attachmentPreviewRow.isPicture = true;
|
||||||
attachmentPreviewRow.visible = true;
|
attachmentPreviewRow.visible = true;
|
||||||
|
@ -1014,7 +1015,7 @@ Page {
|
||||||
var picker = pageStack.push("Sailfish.Pickers.VideoPickerPage");
|
var picker = pageStack.push("Sailfish.Pickers.VideoPickerPage");
|
||||||
picker.selectedContentPropertiesChanged.connect(function(){
|
picker.selectedContentPropertiesChanged.connect(function(){
|
||||||
attachmentOptionsRow.visible = false;
|
attachmentOptionsRow.visible = false;
|
||||||
console.log("Selected video: " + picker.selectedContentProperties.filePath );
|
Debug.log("Selected video: ", picker.selectedContentProperties.filePath );
|
||||||
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
|
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
|
||||||
attachmentPreviewRow.isVideo = true;
|
attachmentPreviewRow.isVideo = true;
|
||||||
attachmentPreviewRow.visible = true;
|
attachmentPreviewRow.visible = true;
|
||||||
|
@ -1029,7 +1030,7 @@ Page {
|
||||||
var picker = pageStack.push("Sailfish.Pickers.DocumentPickerPage");
|
var picker = pageStack.push("Sailfish.Pickers.DocumentPickerPage");
|
||||||
picker.selectedContentPropertiesChanged.connect(function(){
|
picker.selectedContentPropertiesChanged.connect(function(){
|
||||||
attachmentOptionsRow.visible = false;
|
attachmentOptionsRow.visible = false;
|
||||||
console.log("Selected document: " + picker.selectedContentProperties.filePath );
|
Debug.log("Selected document: ", picker.selectedContentProperties.filePath );
|
||||||
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
|
attachmentPreviewRow.fileProperties = picker.selectedContentProperties;
|
||||||
attachmentPreviewRow.isDocument = true;
|
attachmentPreviewRow.isDocument = true;
|
||||||
attachmentPreviewRow.visible = true;
|
attachmentPreviewRow.visible = true;
|
||||||
|
|
|
@ -20,6 +20,7 @@ import QtQuick 2.6
|
||||||
import Sailfish.Silica 1.0
|
import Sailfish.Silica 1.0
|
||||||
import "../components"
|
import "../components"
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
id: imagePage
|
id: imagePage
|
||||||
|
@ -73,7 +74,7 @@ Page {
|
||||||
target: tdLibWrapper
|
target: tdLibWrapper
|
||||||
onFileUpdated: {
|
onFileUpdated: {
|
||||||
if (fileId === imagePage.pictureFileInformation.id) {
|
if (fileId === imagePage.pictureFileInformation.id) {
|
||||||
console.log("File updated, completed? " + fileInformation.local.is_downloading_completed);
|
Debug.log("File updated, completed? ", fileInformation.local.is_downloading_completed);
|
||||||
if (fileInformation.local.is_downloading_completed) {
|
if (fileInformation.local.is_downloading_completed) {
|
||||||
imagePage.pictureFileInformation = fileInformation;
|
imagePage.pictureFileInformation = fileInformation;
|
||||||
imagePage.imageUrl = fileInformation.local.path;
|
imagePage.imageUrl = fileInformation.local.path;
|
||||||
|
|
|
@ -23,6 +23,7 @@ import WerkWolf.Fernschreiber 1.0
|
||||||
import "../components"
|
import "../components"
|
||||||
import "../js/twemoji.js" as Emoji
|
import "../js/twemoji.js" as Emoji
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
id: overviewPage
|
id: overviewPage
|
||||||
|
@ -44,14 +45,14 @@ Page {
|
||||||
Connections {
|
Connections {
|
||||||
target: dBusAdaptor
|
target: dBusAdaptor
|
||||||
onPleaseOpenMessage: {
|
onPleaseOpenMessage: {
|
||||||
console.log("[OverviewPage] Opening chat from external call...")
|
Debug.log("[OverviewPage] Opening chat from external call...")
|
||||||
if (chatListCreated) {
|
if (chatListCreated) {
|
||||||
pageStack.pop(overviewPage, PageStackAction.Immediate)
|
pageStack.pop(overviewPage, PageStackAction.Immediate)
|
||||||
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : chatListModel.getById(chatId) }, PageStackAction.Immediate)
|
pageStack.push(Qt.resolvedUrl("../pages/ChatPage.qml"), { "chatInformation" : chatListModel.getById(chatId) }, PageStackAction.Immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onPleaseOpenUrl: {
|
onPleaseOpenUrl: {
|
||||||
console.log("[OverviewPage] Opening URL requested: " + url);
|
Debug.log("[OverviewPage] Opening URL requested: ", url);
|
||||||
Functions.handleLink(url);
|
Functions.handleLink(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import Sailfish.Silica 1.0
|
||||||
import "../components"
|
import "../components"
|
||||||
import "../js/functions.js" as Functions
|
import "../js/functions.js" as Functions
|
||||||
import "../js/twemoji.js" as Emoji
|
import "../js/twemoji.js" as Emoji
|
||||||
|
import "../js/debug.js" as Debug
|
||||||
|
|
||||||
Page {
|
Page {
|
||||||
id: pollResultsPage
|
id: pollResultsPage
|
||||||
|
@ -146,7 +147,6 @@ Page {
|
||||||
if(extra === optionDelegate.usersResponseIdentifierString) {
|
if(extra === optionDelegate.usersResponseIdentifierString) {
|
||||||
for(var i = 0; i < userIds.length; i += 1) {
|
for(var i = 0; i < userIds.length; i += 1) {
|
||||||
optionDelegate.users.append({id: userIds[i], user:tdLibWrapper.getUserInformation(userIds[i])});
|
optionDelegate.users.append({id: userIds[i], user:tdLibWrapper.getUserInformation(userIds[i])});
|
||||||
console.log("APPEND USER", JSON.stringify({id: userIds[i], user:tdLibWrapper.getUserInformation(userIds[i])}));
|
|
||||||
}
|
}
|
||||||
loadUsersTimer.start();
|
loadUsersTimer.start();
|
||||||
}
|
}
|
||||||
|
|
52
src/debuglogjs.h
Normal file
52
src/debuglogjs.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
Copyright (C) 2020 Sebastian J. Wolf and other contributors
|
||||||
|
|
||||||
|
This file is part of Fernschreiber.
|
||||||
|
|
||||||
|
Fernschreiber is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
Fernschreiber is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Fernschreiber. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DEBUGLOG_H
|
||||||
|
#define DEBUGLOG_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QQmlEngine>
|
||||||
|
|
||||||
|
class DebugLogJS : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged)
|
||||||
|
public:
|
||||||
|
|
||||||
|
#ifdef QT_QML_DEBUG
|
||||||
|
DebugLogJS(QObject* parent = Q_NULLPTR) : QObject(parent), enabled(true) {}
|
||||||
|
#else
|
||||||
|
DebugLog(QObject* parent = Q_NULLPTR) : QObject(parent), enabled(false) {}
|
||||||
|
#endif
|
||||||
|
static QObject* createSingleton(QQmlEngine*, QJSEngine*) { return new DebugLogJS(); }
|
||||||
|
bool isEnabled() const { return enabled; }
|
||||||
|
void setEnabled(bool value) {
|
||||||
|
if (enabled != value) {
|
||||||
|
enabled = value;
|
||||||
|
Q_EMIT enabledChanged(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Q_SIGNALS:
|
||||||
|
void enabledChanged(bool value);
|
||||||
|
private:
|
||||||
|
bool enabled;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DEBUGLOG_H
|
|
@ -29,8 +29,8 @@
|
||||||
#include <QQmlEngine>
|
#include <QQmlEngine>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
|
|
||||||
#include "appsettings.h"
|
#include "appsettings.h"
|
||||||
|
#include "debuglogjs.h"
|
||||||
#include "tdlibfile.h"
|
#include "tdlibfile.h"
|
||||||
#include "tdlibwrapper.h"
|
#include "tdlibwrapper.h"
|
||||||
#include "chatlistmodel.h"
|
#include "chatlistmodel.h"
|
||||||
|
@ -63,6 +63,7 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
const char *uri = "WerkWolf.Fernschreiber";
|
const char *uri = "WerkWolf.Fernschreiber";
|
||||||
qmlRegisterType<TDLibFile>(uri, 1, 0, "TDLibFile");
|
qmlRegisterType<TDLibFile>(uri, 1, 0, "TDLibFile");
|
||||||
|
qmlRegisterSingletonType<DebugLogJS>(uri, 1, 0, "DebugLog", DebugLogJS::createSingleton);
|
||||||
|
|
||||||
AppSettings *appSettings = new AppSettings(view.data());
|
AppSettings *appSettings = new AppSettings(view.data());
|
||||||
context->setContextProperty("appSettings", appSettings);
|
context->setContextProperty("appSettings", appSettings);
|
||||||
|
|
Loading…
Reference in a new issue