diff --git a/harbour-kat.desktop b/harbour-kat.desktop deleted file mode 100755 index abbfd29..0000000 --- a/harbour-kat.desktop +++ /dev/null @@ -1,13 +0,0 @@ -[Desktop Entry] -Type=Application -X-Nemo-Application-Type=silica-qt5 -Icon=harbour-kat -Exec=harbour-kat -Name=AuroraKat - -[X-Application] -Permissions=Internet;Audio;Microphone;Pictures;UserDirs;MediaIndexing -OrganizationName=ru.ilyavysotsky -ApplicationName=aurorakat -ExecDBus=/usr/bin/harbour-kat -ExportDBusInterfaces=ru.ilyavysotsky.aurorakat diff --git a/harbour-kat.pro b/harbour-kat.pro deleted file mode 100755 index aad9fa2..0000000 --- a/harbour-kat.pro +++ /dev/null @@ -1,104 +0,0 @@ -# NOTICE: -# -# Application name defined in TARGET has a corresponding QML filename. -# If name defined in TARGET is changed, the following needs to be done -# to match new name: -# - corresponding QML filename must be changed -# - desktop icon filename must be changed -# - desktop filename must be changed -# - icon definition filename in desktop file must be changed -# - translation filenames have to be changed - -# The name of your application -TARGET = harbour-kat - -CONFIG += \ - auroraapp -greaterThan(QT_VERSION, 5.5) { - CONFIG += C++11 -} else { - QMAKE_CXXFLAGS += -std=gnu++11 -} - -QT += multimedia core gui qml quick - -include("vksdk/vksdk.pri") - -HEADERS += \ - src/settingswrapper.h \ - src/mediaplayerwrapper.h \ - src/playlistmodel.h \ - src/filesaver.h \ - src/utils.h - -SOURCES += \ - src/harbour-kat.cpp \ - src/settingswrapper.cpp \ - src/mediaplayerwrapper.cpp \ - src/playlistmodel.cpp \ - src/filesaver.cpp \ - src/utils.cpp - -OTHER_FILES += \ - qml/harbour-kat.qml \ - qml/cover/*.qml \ - qml/pages/*.qml \ - qml/views/*.qml \ - translations/*.ts \ - rpm/harbour-kat.spec \ - rpm/harbour-kat.changes.in \ - LICENSE \ - README.md - -AURORAAPP_ICONS = 86x86 108x108 128x128 172x172 - -CONFIG += auroraapp_i18n -TRANSLATIONS += \ - translations/harbour-kat-ru.ts \ - translations/harbour-kat-it.ts \ - translations/harbour-kat-nl.ts \ - translations/harbour-kat-az.ts - -DISTFILES += \ - qml/pages/MainMenuPage.qml \ - qml/pages/LoginPage.qml \ - qml/pages/DialogsListPage.qml \ - qml/pages/ProfilePage.qml \ - qml/pages/ImageViewPage.qml \ - qml/pages/FriendsListPage.qml \ - qml/views/UserListItem.qml \ - qml/pages/DialogPage.qml \ - qml/views/MessageItem.qml \ - qml/views/FwdMessages.qml \ - qml/views/AttachmentsView.qml \ - qml/views/GeoItem.qml \ - qml/views/PhotosView.qml \ - qml/views/VideosView.qml \ - qml/views/AudiosView.qml \ - qml/views/DocumentsView.qml \ - qml/views/NewsView.qml \ - qml/pages/WallPostPage.qml \ - qml/views/WallPostView.qml \ - qml/views/RepostView.qml \ - qml/pages/NewsfeedPage.qml \ - qml/views/DialogImage.qml \ - qml/pages/AudioPlayerPage.qml \ - qml/pages/VideoPlayerPage.qml \ - qml/pages/AboutPage.qml \ - qml/views/LinksView.qml \ - qml/views/MoreButton.qml \ - qml/views/CollapsedView.qml \ - qml/views/BoxBackground.qml \ - qml/pages/GroupsListPage.qml \ - qml/pages/GroupProfilePage.qml \ - qml/views/WallItem.qml \ - qml/pages/RepostPage.qml \ - qml/pages/StatisticsPage.qml \ - qml/pages/SettingsPage.qml \ - qml/pages/PhotoAlbumPage.qml \ - qml/pages/TopicsPage.qml \ - qml/pages/TopicPage.qml \ - qml/pages/MediaListItem.qml \ - qml/pages/MediaPlayerPanelBackground.qml \ - qml/pages/MediaPlayerControlPanel - diff --git a/icons/108x108/harbour-kat.png b/icons/108x108/ru.ilyavysotsky.aurorakat.png similarity index 100% rename from icons/108x108/harbour-kat.png rename to icons/108x108/ru.ilyavysotsky.aurorakat.png diff --git a/icons/128x128/harbour-kat.png b/icons/128x128/ru.ilyavysotsky.aurorakat.png similarity index 100% rename from icons/128x128/harbour-kat.png rename to icons/128x128/ru.ilyavysotsky.aurorakat.png diff --git a/icons/172x172/harbour-kat.png b/icons/172x172/ru.ilyavysotsky.aurorakat.png similarity index 100% rename from icons/172x172/harbour-kat.png rename to icons/172x172/ru.ilyavysotsky.aurorakat.png diff --git a/icons/86x86/harbour-kat.png b/icons/86x86/ru.ilyavysotsky.aurorakat.png old mode 100755 new mode 100644 similarity index 100% rename from icons/86x86/harbour-kat.png rename to icons/86x86/ru.ilyavysotsky.aurorakat.png diff --git a/qml/harbour-kat.qml b/qml/aurorakat.qml old mode 100755 new mode 100644 similarity index 66% rename from qml/harbour-kat.qml rename to qml/aurorakat.qml index 76110ca..1986346 --- a/qml/harbour-kat.qml +++ b/qml/aurorakat.qml @@ -64,7 +64,11 @@ ApplicationWindow Notification { id: commonNotification - category: "harbour-kat" + appIcon: "ru.ilyavysotsky.aurorakat" + category: "AuroraKat" + appName: "AuroraKat" + urgency: Notification.Critical + //replacesId: 0 remoteActions: [ { "name": "default", "service": "ru.ilyavysotsky.aurorakat", @@ -102,8 +106,8 @@ ApplicationWindow canGoPrevious: true canPause: true canPlay: true - canSeek: false - + canSeek: true + desktopEntry: "AuroraKat" playbackStatus: player.isPlaying ? Mpris.Playing : Mpris.Paused @@ -115,21 +119,33 @@ ApplicationWindow mprisPlayer.setMetadata(metadata)*/ // } - onArtistChanged: { - var metadata = mprisPlayer.metadata + // onArtistChanged: { + /*var metadata = mprisPlayer.metadata - metadata[Mpris.metadataToString(Mpris.Artist)] = [artist] // List of strings + console.log(artist) - mprisPlayer.metadata = metadata - } + metadata['xesam:artist'] = [artist] // List of strings - onSongChanged: { - var metadata = mprisPlayer.metadata + mprisPlayer.metadata = metadata*/ - metadata[Mpris.metadataToString(Mpris.Title)] = song // String + // mprisPlayer.artist = artist + //} - mprisPlayer.metadata = metadata - } + // onSongChanged: { + /* var metadata = mprisPlayer.metadata + metaData.title = track.title*/ + /*var metadata = mprisPlayer.metadata + + console.log(song) + + metadata['xesam:title'] = song // String + + mprisPlayer.metadata = metadata*/ + + // console.log(mprisPlayer.song) + + //mprisPlayer.song = song + //} onPauseRequested: { player.pause() @@ -161,12 +177,15 @@ ApplicationWindow Connections { target: vksdk onGotNewMessage: { - commonNotification.close() + //commonNotification.close() + commonNotification.replacesId = 0 commonNotification.summary = name commonNotification.previewSummary = name commonNotification.body = preview commonNotification.previewBody = preview - + commonNotification.appIcon = "ru.ilyavysotsky.aurorakat" + commonNotification.appName = "AuroraKat" + commonNotification.urgency = Notification.Critical commonNotification.category = "x-nemo.messaging.im" commonNotification.publish() @@ -182,63 +201,46 @@ ApplicationWindow } Connections { - target: netcfgmgr - onConfigurationChanged: { - console.log("onConfigurationChanged") - //vksdk.longPoll.getLongPollServer() - } + target: netcfgmgr + onConfigurationChanged: { + console.log("onConfigurationChanged") + //vksdk.longPoll.getLongPollServer() } + } - DBusAdaptor { - id: dbus + DBusAdaptor { + id: dbus - service: "ru.ilyavysotsky.aurorakat" - iface: "ru.ilyavysotsky.aurorakat" - path: "/ru/ilyavysotsky/aurorakat" + service: "ru.ilyavysotsky.aurorakat" + iface: "ru.ilyavysotsky.aurorakat" + path: "/ru/ilyavysotsky/aurorakat" - xml: ' \n' + - ' \n' + - ' \n' + xml: ' \n' + + ' \n' + + ' \n' - function activateApp() - { - if ( !application.applicationActive ) { - application.activate() - } + function activateApp() + { + if ( !application.applicationActive ) { + application.activate() } } + } Connections { target: player onMediaChanged: { - //qDebug() << "mediachanged" - - mprisPlayer.song = player.title - mprisPlayer.artist = player.author - //var metaData = mprisPlayer.metaData - //metaData['mpris:title'] = "test" - //metaData['mpris:albumArtist'] = "test" - //metaData[Mpris.metadataToString(Mpris.albumArtist)] = "test" - //metaData[Mpris.metadataToString(Mpris.Title)] = "test" - //mprisPlayer.metaData = metaData - //metaData['xesam:title'] = "test" - // metaData['xesam:albumArtist'] = "test" - //mprisPlayer.setMetadata(metaData) + var metaData = mprisPlayer.metadata + // console.log(metaData) + //console.log(player.title) + + mprisPlayer.metaData.title = player.title + mprisPlayer.metaData.contributingArtist = player.author } - /* onStateChanged: { - // qDebug() << "statechanged" - var metaData = mprisPlayer.metaData - // metaData['mpris:title'] = "app.streamMetaText1" - // metaData['mpris:albumArtist'] = "app.stationName" - //metadata[Mpris.metadataToString(Mpris.albumArtist)] = player.author - //metadata[Mpris.metadataToString(Mpris.Title)] = player.title - metaData[Mpris.metadataToString(Mpris.albumArtist)] = "test" - metaData[Mpris.metadataToString(Mpris.Title)] = "test" - mprisPlayer.setMetadata(metaData) - }*/ + } diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index f8e7481..52b8e97 100755 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -33,7 +33,7 @@ Page { PageHeader { id: header - title: qsTr("About") + "AuroraKat" + title: qsTr("About") + " AuroraKat" } Column { @@ -53,7 +53,7 @@ Page { Label { width: parent.width horizontalAlignment: Text.AlignHCenter - text: "v0.6.7" + text: "v0.6.8" } Label { diff --git a/qml/pages/LoginPage.qml b/qml/pages/LoginPage.qml index f2743f3..4be65a5 100755 --- a/qml/pages/LoginPage.qml +++ b/qml/pages/LoginPage.qml @@ -32,7 +32,7 @@ Page { Notification { id: loginNotification - category: "harbour-kat" + category: "aurorakat" } Label { diff --git a/rpm/harbour-kat.spec b/rpm/harbour-kat.spec deleted file mode 100755 index 36f0116..0000000 --- a/rpm/harbour-kat.spec +++ /dev/null @@ -1,76 +0,0 @@ -# -# Do NOT Edit the Auto-generated Part! -# Generated by: spectacle version 0.32 -# - -Name: harbour-kat - -# >> macros -# << macros - -%{!?qtc_qmake:%define qtc_qmake %qmake} -%{!?qtc_qmake5:%define qtc_qmake5 %qmake5} -%{!?qtc_make:%define qtc_make make} -%{?qtc_builddir:%define _builddir %qtc_builddir} -Summary: The unofficial client for vk.com -Version: 0.6.7 -Release: 1 -Group: Qt/Qt -License: GNU GPLv3 -URL: https://vk.com/mobilevika -Source0: %{name}-%{version}.tar.bz2 -Source100: harbour-kat.yaml -Requires: sailfishsilica-qt5 >= 0.10.9 -Requires: sailfish-components-webview-qt5 -Requires: sailfish-components-webview-qt5-pickers -Requires: sailfish-components-webview-qt5-popups -BuildRequires: pkgconfig(sailfishapp) >= 1.0.2 -BuildRequires: pkgconfig(Qt5Core) -BuildRequires: pkgconfig(Qt5Qml) -BuildRequires: pkgconfig(Qt5Quick) -BuildRequires: pkgconfig(Qt5Network) -BuildRequires: desktop-file-utils - -%description -The unofficial client for the most popular social network developed by Linux User Group Udmurtia and shared under the terms of the GNU General Public Licence version 3. - - -%prep -%setup -q -n %{name}-%{version} - -# >> setup -# << setup - -%build -# >> build pre -# << build pre - -%qtc_qmake5 - -%qtc_make %{?_smp_mflags} - -# >> build post -# << build post - -%install -rm -rf %{buildroot} -# >> install pre -# << install pre -%qmake5_install - -# >> install post -# << install post - -desktop-file-install --delete-original \ - --dir %{buildroot}%{_datadir}/applications \ - %{buildroot}%{_datadir}/applications/*.desktop - - -%files -%defattr(-,root,root,-) -%{_bindir} -%{_datadir}/%{name} -%{_datadir}/applications/%{name}.desktop -%{_datadir}/icons/hicolor/*/apps/%{name}.png -# >> files -# << files diff --git a/rpm/ru.ilyavysotsky.aurorakat.changes.in b/rpm/ru.ilyavysotsky.aurorakat.changes.in new file mode 100644 index 0000000..80dead2 --- /dev/null +++ b/rpm/ru.ilyavysotsky.aurorakat.changes.in @@ -0,0 +1,15 @@ +# Rename this file as ru.ilyavysotsky.aurorakat.changes to include changelog +# entries in your RPM file. +# +# Add new changelog entries following the format below. +# Add newest entries to the top of the list. +# Separate entries from eachother with a blank line. +# +# Alternatively, if your changelog is automatically generated (e.g. with +# the git-change-log command provided with Sailfish OS SDK), create a +# ru.ilyavysotsky.aurorakat.changes.run script to let mb2 run the required commands for you. + +# * date Author's Name version-release +# - Summary of changes + + diff --git a/rpm/ru.ilyavysotsky.aurorakat.changes.run.in b/rpm/ru.ilyavysotsky.aurorakat.changes.run.in new file mode 100644 index 0000000..985f37c --- /dev/null +++ b/rpm/ru.ilyavysotsky.aurorakat.changes.run.in @@ -0,0 +1,25 @@ +#!/bin/bash +# +# Rename this file as ru.ilyavysotsky.aurorakat.changes.run to let mb2 automatically +# generate changelog from well formatted Git commit messages and tag +# annotations. + +git-change-log + +# Here are some basic examples how to change from the default behavior. Run +# git-change-log --help inside the Aurora OS SDK chroot or build engine to +# learn all the options git-change-log accepts. + +# Use a subset of tags +#git-change-log --tags refs/tags/my-prefix/* + +# Group entries by minor revision, suppress headlines for patch-level revisions +#git-change-log --dense '/[0-9]+.[0-9+$' + +# Trim very old changes +#git-change-log --since 2014-04-01 +#echo '[ Some changelog entries trimmed for brevity ]' + +# Use the subjects (first lines) of tag annotations when no entry would be +# included for a revision otherwise +#git-change-log --auto-add-annotations diff --git a/rpm/ru.ilyavysotsky.aurorakat.spec b/rpm/ru.ilyavysotsky.aurorakat.spec new file mode 100644 index 0000000..e44ff29 --- /dev/null +++ b/rpm/ru.ilyavysotsky.aurorakat.spec @@ -0,0 +1,33 @@ +Name: ru.ilyavysotsky.aurorakat +Summary: Неофициальное приложение ВКонтакте для ОС Аврора +Version: 0.6.8 +Release: 1 +License: BSD-3-Clause +URL: https://auroraos.ru +Source0: %{name}-%{version}.tar.bz2 + +Requires: sailfishsilica-qt5 >= 0.10.9 +BuildRequires: pkgconfig(auroraapp) +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Qml) +BuildRequires: pkgconfig(Qt5Quick) + + +%description +Неофициальное приложение ВКонтакте для ОС Аврора by @okabe2011 (Илья Высоцкий) + +%prep +%autosetup + +%build +%qmake5 +%make_build + +%install +%qmake5_install + +%files +%{_bindir}/%{name} +%{_datadir}/%{name} +%{_datadir}/applications/%{name}.desktop +%{_datadir}/icons/hicolor/*/apps/%{name}.png diff --git a/ru.ilyavysotsky.aurorakat.desktop b/ru.ilyavysotsky.aurorakat.desktop new file mode 100644 index 0000000..dd6a8ff --- /dev/null +++ b/ru.ilyavysotsky.aurorakat.desktop @@ -0,0 +1,14 @@ +[Desktop Entry] +Type=Application +X-Nemo-Application-Type=silica-qt5 +Icon=ru.ilyavysotsky.aurorakat +Exec=/usr/bin/ru.ilyavysotsky.aurorakat +Name=aurorakat +Name[ru]=AuroraKat + +[X-Application] +Permissions=PushNotifications;Audio;Camera;Internet;Location;MediaIndexing;Microphone;UserDirs;WebView +OrganizationName=ru.ilyavysotsky +ApplicationName=aurorakat +ExecDBus=/usr/bin/ru.ilyavysotsky.aurorakat +ExportDBusInterfaces=ru.ilyavysotsky.aurorakat diff --git a/ru.ilyavysotsky.aurorakat.pro b/ru.ilyavysotsky.aurorakat.pro new file mode 100644 index 0000000..30a93ac --- /dev/null +++ b/ru.ilyavysotsky.aurorakat.pro @@ -0,0 +1,88 @@ +################################################################################ +## +## Copyright (C) 2022 ru.ilyavysotsky +## +## This file is part of the Неофициальное приложение ВКонтакте для ОС Аврора project. +## +## Redistribution and use in source and binary forms, +## with or without modification, are permitted provided +## that the following conditions are met: +## +## * Redistributions of source code must retain the above copyright notice, +## this list of conditions and the following disclaimer. +## * Redistributions in binary form must reproduce the above copyright notice, +## this list of conditions and the following disclaimer +## in the documentation and/or other materials provided with the distribution. +## * Neither the name of the copyright holder nor the names of its contributors +## may be used to endorse or promote products derived from this software +## without specific prior written permission. +## +## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +## FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +## FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +## OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +## LOSS OF USE, DATA, OR PROFITS; +## OR BUSINESS INTERRUPTION) +## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +## (INCLUDING NEGLIGENCE OR OTHERWISE) +## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +## EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +## +################################################################################ + +TARGET = ru.ilyavysotsky.aurorakat + +PKGCONFIG += \ + +CONFIG += \ + auroraapp +greaterThan(QT_VERSION, 5.5) { + CONFIG += C++11 +} else { + QMAKE_CXXFLAGS += -std=gnu++11 +} + +QT += multimedia core gui qml quick + +include("vksdk/vksdk.pri") + +HEADERS += \ + src/settingswrapper.h \ + src/mediaplayerwrapper.h \ + src/playlistmodel.h \ + src/filesaver.h \ + src/utils.h + +SOURCES += \ + src/harbour-kat.cpp \ + src/settingswrapper.cpp \ + src/mediaplayerwrapper.cpp \ + src/playlistmodel.cpp \ + src/filesaver.cpp \ + src/utils.cpp + + +DISTFILES += \ + rpm/ru.ilyavysotsky.aurorakat.spec \ + AUTHORS.md \ + CODE_OF_CONDUCT.md \ + CONTRIBUTING.md \ + LICENSE.BSD-3-CLAUSE.md \ + README.md \ + qml/harbour-kat.qml \ + qml/cover/*.qml \ + qml/pages/*.qml \ + qml/views/*.qml \ + +AURORAAPP_ICONS = 86x86 108x108 128x128 172x172 + +CONFIG += auroraapp_i18n + +TRANSLATIONS += \ + translations/ru.ilyavysotsky.aurorakat.ts \ + translations/ru.ilyavysotsky.aurorakat-ru.ts \ diff --git a/src/harbour-kat.cpp b/src/harbour-kat.cpp index ccb6504..72c6aa7 100755 --- a/src/harbour-kat.cpp +++ b/src/harbour-kat.cpp @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) { QScopedPointer vksdk(new VkSDK(view.data())); view->rootContext()->setContextProperty("vksdk", vksdk.data()); - view->setSource(Aurora::Application::pathTo("qml/harbour-kat.qml")); + view->setSource(Aurora::Application::pathTo("qml/aurorakat.qml")); view->show(); return application->exec(); diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..0d7899f --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,52 @@ +/******************************************************************************* +** +** Copyright (C) 2022 ru.ilyavysotsky +** +** This file is part of the Неофициальное приложение ВКонтакте для ОС Аврора project. +** +** Redistribution and use in source and binary forms, +** with or without modification, are permitted provided +** that the following conditions are met: +** +** * Redistributions of source code must retain the above copyright notice, +** this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer +** in the documentation and/or other materials provided with the distribution. +** * Neither the name of the copyright holder nor the names of its contributors +** may be used to endorse or promote products derived from this software +** without specific prior written permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +** THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +** IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, +** OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +** LOSS OF USE, DATA, OR PROFITS; +** OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) +** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +** EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +** +*******************************************************************************/ + +#include +#include + +int main(int argc, char *argv[]) +{ + QScopedPointer application(Aurora::Application::application(argc, argv)); + application->setOrganizationName(QStringLiteral("ru.ilyavysotsky")); + application->setApplicationName(QStringLiteral("aurorakat")); + + QScopedPointer view(Aurora::Application::createView()); + view->setSource(Aurora::Application::pathTo(QStringLiteral("qml/aurorakat.qml"))); + view->show(); + + return application->exec(); +} \ No newline at end of file diff --git a/translations/harbour-kat-az.ts b/translations/ru.ilyavysotsky.aurorakat-az.ts similarity index 100% rename from translations/harbour-kat-az.ts rename to translations/ru.ilyavysotsky.aurorakat-az.ts diff --git a/translations/harbour-kat-it.ts b/translations/ru.ilyavysotsky.aurorakat-it.ts similarity index 100% rename from translations/harbour-kat-it.ts rename to translations/ru.ilyavysotsky.aurorakat-it.ts diff --git a/translations/harbour-kat-nl.ts b/translations/ru.ilyavysotsky.aurorakat-nl.ts similarity index 100% rename from translations/harbour-kat-nl.ts rename to translations/ru.ilyavysotsky.aurorakat-nl.ts diff --git a/translations/harbour-kat-ru.ts b/translations/ru.ilyavysotsky.aurorakat-ru.ts old mode 100755 new mode 100644 similarity index 100% rename from translations/harbour-kat-ru.ts rename to translations/ru.ilyavysotsky.aurorakat-ru.ts diff --git a/translations/harbour-kat.ts b/translations/ru.ilyavysotsky.aurorakat.ts old mode 100755 new mode 100644 similarity index 100% rename from translations/harbour-kat.ts rename to translations/ru.ilyavysotsky.aurorakat.ts diff --git a/vksdk/src/authorization.cpp b/vksdk/src/authorization.cpp index d26e932..1e0c6ff 100755 --- a/vksdk/src/authorization.cpp +++ b/vksdk/src/authorization.cpp @@ -119,14 +119,17 @@ void Authorization::finished(QNetworkReply *reply) { QJsonObject jObj = jDoc.object(); QString strFromObj = QJsonDocument(jObj).toJson(QJsonDocument::Compact).toStdString().c_str(); qDebug() << strFromObj; - if (jObj.contains("invalid_client")) { + if (strFromObj.contains("invalid_client")) { emit error(QString("Неверный пароль"),QString("Неверный пароль")); + reply->deleteLater(); + return; } if (jObj.contains("access_token")) { emit authorized(jObj.value("access_token").toString(), jObj.value("user_id").toInt()); - + reply->deleteLater(); + return; } else { // strFromObj.contains("2fa") emit captcharequired(jObj.value("error").toString(),jObj.value("1").toString()); diff --git a/vksdk/src/longpoll.cpp b/vksdk/src/longpoll.cpp index 53bb9c6..1fa5bbf 100755 --- a/vksdk/src/longpoll.cpp +++ b/vksdk/src/longpoll.cpp @@ -148,9 +148,9 @@ void LongPoll::finished(QNetworkReply *reply) { return; } QByteArray qb = reply->readAll(); - qDebug() << " err7 "; + if (qb.isEmpty() || qb.isNull()) { return; } - qDebug() << "\n" << qb << "\n"; + QJsonDocument jDoc = QJsonDocument::fromJson(qb); if (reply->request().url().query().contains("need_pts") && (jDoc.object().contains("response"))) { QJsonObject jObj = jDoc.object().value("response").toObject(); diff --git a/vksdk/src/objects/dialog.cpp b/vksdk/src/objects/dialog.cpp index 1705161..374c6c2 100755 --- a/vksdk/src/objects/dialog.cpp +++ b/vksdk/src/objects/dialog.cpp @@ -20,6 +20,7 @@ */ #include "dialog.h" +#include "vksdk/src/vksdk.h" Dialog::Dialog(QObject *parent) : QObject(parent) { qRegisterMetaType("Message*"); @@ -34,6 +35,8 @@ Dialog *Dialog::fromJsonObject(QJsonObject object) { dialog->setLastMessage(Message::fromJsonObject(object.value("last_message").toObject())); dialog->setIsChat(dialog->lastMessage()->chat()); dialog->setUnread(object.contains("unread") || !dialog->lastMessage()->readState()); + dialog->setMuted(object.value("conversation").toObject().contains("push_settings") ? (object.value("conversation").toObject().value("push_settings").toObject().value("disabled_forever").toBool() || object.value("conversation").toObject().value("push_settings").toObject().value("no_sound").toBool()) : false); + if (dialog->muted()) { VkSDK::mutedChats.append(dialog->lastMessage()->peerId()); } return dialog; } @@ -47,6 +50,16 @@ void Dialog::setUnread(bool unread) _unread = unread; } +bool Dialog::muted() const +{ + return _muted; +} + +void Dialog::setMuted(bool muted) +{ + _muted = muted; +} + bool Dialog::isChat() const { return _isChat; diff --git a/vksdk/src/objects/dialog.h b/vksdk/src/objects/dialog.h index 38af1b3..54933d3 100755 --- a/vksdk/src/objects/dialog.h +++ b/vksdk/src/objects/dialog.h @@ -42,6 +42,9 @@ class Dialog : public QObject bool unread() const; void setUnread(bool unread); + bool muted() const; + void setMuted(bool muted); + bool isChat() const; void setIsChat(bool isChat); @@ -50,6 +53,7 @@ class Dialog : public QObject private: bool _unread; + bool _muted; bool _isChat; Message *_lastMessage; }; diff --git a/vksdk/src/requests/messages.cpp b/vksdk/src/requests/messages.cpp index c8841aa..6156fca 100755 --- a/vksdk/src/requests/messages.cpp +++ b/vksdk/src/requests/messages.cpp @@ -23,6 +23,7 @@ #include #include "src/utils.h" #include +#include "vksdk/src/vksdk.h" Messages::Messages(QObject *parent) : RequestBase(parent) {} @@ -41,6 +42,7 @@ void Messages::getChat(const QStringList &ids) { } void Messages::getDialogs(int offset) { + VkSDK::mutedChats.clear(); QUrlQuery query; query.addQueryItem("offset", QString::number(offset)); query.addQueryItem("extended", "1"); diff --git a/vksdk/src/vksdk.cpp b/vksdk/src/vksdk.cpp index 1ee3c6d..ca1b359 100755 --- a/vksdk/src/vksdk.cpp +++ b/vksdk/src/vksdk.cpp @@ -21,15 +21,17 @@ #include "vksdk.h" +QList VkSDK::mutedChats = QList(); + VkSDK::VkSDK(QObject *parent) : QObject(parent) { // basic: _api = new ApiRequest(this); _auth = new Authorization(this); qRegisterMetaType("Authorization*"); connect(_api, &ApiRequest::gotResponse, this, &VkSDK::gotResponse); -// connect(_api, &ApiRequest::gotResponse, -// [this] (QJsonValue value, ApiRequest::TaskType type) { QtConcurrent::run(this, &VkSDK::gotResponse, value, type); }); -// [this] (QJsonValue value, ApiRequest::TaskType type) { gotResponse(value, type); }); + // connect(_api, &ApiRequest::gotResponse, + // [this] (QJsonValue value, ApiRequest::TaskType type) { QtConcurrent::run(this, &VkSDK::gotResponse, value, type); }); + // [this] (QJsonValue value, ApiRequest::TaskType type) { gotResponse(value, type); }); _longPoll = new LongPoll(this); connect(_longPoll, SIGNAL(gotNewMessage(int)), this, SLOT(_gotNewMessage(int))); @@ -51,7 +53,7 @@ VkSDK::VkSDK(QObject *parent) : QObject(parent) { _users = new Users(this); _videos = new Videos(this); _wall = new Wall(this); - // _longPoll->setApi(_api); + // _longPoll->setApi(_api); _account->setApi(_api); _audios->setApi(_api); _board->setApi(_api); @@ -105,11 +107,11 @@ VkSDK::VkSDK(QObject *parent) : QObject(parent) { qRegisterMetaType("PhotosModel*"); -// qRegisterMetaType("Audio*"); -// qRegisterMetaType("Document*"); -// qRegisterMetaType("Photo*"); -// qRegisterMetaType("Friend*"); -// qRegisterMetaType("Video*"); + // qRegisterMetaType("Audio*"); + // qRegisterMetaType("Document*"); + // qRegisterMetaType("Photo*"); + // qRegisterMetaType("Friend*"); + // qRegisterMetaType("Video*"); } VkSDK::~VkSDK() { @@ -141,7 +143,7 @@ VkSDK::~VkSDK() { delete _wallModel; delete _photosModel; -// delete _selfProfile; + // delete _selfProfile; } void VkSDK::setAccessTocken(QString value) { @@ -163,21 +165,21 @@ bool VkSDK::checkToken(QString token) { request.setRawHeader("Authorization", "Bearer "+token.toUtf8()); qDebug () << request.rawHeader("Authorization"); QNetworkAccessManager* _manager = new QNetworkAccessManager(this); - // connect(_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(finished(QNetworkReply*))); + // connect(_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(finished(QNetworkReply*))); QNetworkReply *reply = _manager->get(request); QEventLoop looppp; QObject::connect(reply, SIGNAL(finished()) , &looppp, SLOT(quit())); looppp.exec(); - QByteArray dataaa = reply->readAll(); - QString DataAsString = QString::fromUtf8(dataaa); + QByteArray dataaa = reply->readAll(); + QString DataAsString = QString::fromUtf8(dataaa); // qDebug() << DataAsString; - if (DataAsString.contains("error")) { - return false; - } else if (DataAsString.contains("authorization failed")) { - return false; - } else { - return true; - } + if (DataAsString.contains("error")) { + return false; + } else if (DataAsString.contains("authorization failed")) { + return false; + } else { + return true; + } } void VkSDK::setUserId(int value) { @@ -369,7 +371,7 @@ void VkSDK::gotResponse(const QJsonValue &value, ApiRequest::TaskType type) { if (_messagePreview.isEmpty()) emit gotProfile(parseUserProfile(value.toArray())); else { emit gotNewMessage(QString("%1 %2").arg(parseUserProfile(value.toArray())->getFirstName()) - .arg(parseUserProfile(value.toArray())->getLastName()), + .arg(parseUserProfile(value.toArray())->getLastName()), _messagePreview); _messagePreview.clear(); } @@ -427,7 +429,7 @@ void VkSDK::parseChatsInfo(QJsonArray array) { for (int index = 0; index < array.size(); ++index) { Chat *chat = Chat::fromJsonObject(array.at(index).toObject()); if (chat->users().size()>0) { - foreach (QVariant user, chat->users()) _usersIds.append(user.toString()); + foreach (QVariant user, chat->users()) _usersIds.append(user.toString()); } //foreach (QVariant user, chat->users()) _usersIds.append(user.toString()); @@ -435,8 +437,8 @@ void VkSDK::parseChatsInfo(QJsonArray array) { _dialogsListModel->addChat(chat); } if (array.size()>0) { - _usersIds.removeDuplicates(); - _users->getUsersByIds(_usersIds); + _usersIds.removeDuplicates(); + _users->getUsersByIds(_usersIds); } } @@ -459,6 +461,8 @@ void VkSDK::parseComments(QJsonObject object) { } void VkSDK::parseDialogsInfo(QJsonObject object) { + QString strFromObj = QJsonDocument(object).toJson(QJsonDocument::Compact).toStdString().c_str(); + // qDebug() << "parseDialogsInfo" << strFromObj; if (object.contains("unread_count")) emit gotUnreadCounter(object.value("unread_count").toInt()); parseFriendsInfo(object.value("profiles").toArray()); parseGroupsInfo(object.value("groups").toArray()); @@ -469,20 +473,20 @@ void VkSDK::parseDialogsInfo(QJsonObject object) { else _usersIds.append(QString::number(dialog->lastMessage()->peerId())); _dialogsListModel->add(dialog); } - if (_chatsIds.empty()) { - //if (!(_usersIds.empty())) { + if (_chatsIds.empty()) { + //if (!(_usersIds.empty())) { _usersIds.removeDuplicates(); _users->getUsersByIds(_usersIds); - //} + //} } else _messages->getChat(_chatsIds); } void VkSDK::resetDialogsModel() { - // _dialogsListModel->modelReset(QAbstractItemModel); + // _dialogsListModel->modelReset(QAbstractItemModel); } void VkSDK::parseEntireFriendsList(QJsonArray array) { @@ -554,6 +558,7 @@ void VkSDK::parseMessages(QJsonArray array) { void VkSDK::parseNewMessage(QJsonObject object) { Message *message = Message::fromJsonObject(object); + qDebug() << "parsing " << QJsonDocument(object).toJson(QJsonDocument::Compact); /*if (message->chat()) { message->setFromId(message->fromId()); message->setPeerId(message->peerId()); @@ -566,11 +571,13 @@ void VkSDK::parseNewMessage(QJsonObject object) { // Update chat _messagesModel->addToBegin(message); // Show notification - _users->getUserProfile(message->fromId()); + _users->getUserProfile(message->fromId()); + // qDebug() << VkSDK::mutedChats; + if (VkSDK::mutedChats.contains(message->peerId())) return; if (message->out()) return; _messagePreview = (message->hasAttachments() ? "[ 📎 ] " : "") + message->body(); //_users->getUserProfile(message->fromId()); - // qDebug() << "...finished..."; + // qDebug() << "...finished..."; } void VkSDK::parseNewsfeed(QJsonObject object, bool isWall) { @@ -625,7 +632,7 @@ void VkSDK::parseSavedPhotoData(QJsonArray array) { void VkSDK::parseSavedDocData(QJsonObject doc) { QJsonObject docdoc = doc.value("doc").toObject(); emit savedDoc(QString("doc%1_%2").arg(QString::number(docdoc.value("owner_id").toInt())) - .arg(QString::number(docdoc.value("id").toInt()))); + .arg(QString::number(docdoc.value("id").toInt()))); } void VkSDK::parseStatistics(QJsonArray array) { diff --git a/vksdk/src/vksdk.h b/vksdk/src/vksdk.h index f3b1f55..1ba12b2 100755 --- a/vksdk/src/vksdk.h +++ b/vksdk/src/vksdk.h @@ -136,6 +136,8 @@ class VkSDK : public QObject Q_INVOKABLE void attachPhotoToMessage(QString path); Q_INVOKABLE void attachDocToMessage(QString path); + static QList mutedChats; + // User* selfProfile() const; signals: