Skip to content

Commit

Permalink
Merge pull request #638 from nuttyartist/subscription
Browse files Browse the repository at this point in the history
Implement subscription
  • Loading branch information
nuttyartist authored Aug 30, 2023
2 parents a58d78f + 5b0955e commit a8d4dc6
Show file tree
Hide file tree
Showing 10 changed files with 2,216 additions and 756 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ if(QT_VERSION VERSION_GREATER_EQUAL 6.2)
src/qml/FontIconsCodes.qml
src/qml/IconButton.qml
src/qml/OptionItemButton.qml
src/qml/ProPaymentWindow.qml
src/qml/SubscriptionWindow.qml
src/qml/SwitchButton.qml
src/qml/TextButton.qml
src/qml/ThemeChooserButton.qml
Expand Down
Binary file modified src/fonts/fontawesome/fa-regular-400.ttf
Binary file not shown.
366 changes: 337 additions & 29 deletions src/mainwindow.cpp

Large diffs are not rendered by default.

40 changes: 38 additions & 2 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
#include <QVariant>
#include <QJsonObject>
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QByteArray>
#include <QQmlApplicationEngine>

#include "nodedata.h"
#include "notelistmodel.h"
Expand All @@ -47,6 +52,9 @@
#include "nodetreeview.h"
#include "editorsettingsoptions.h"

L_DECLARE_ENUM(SubscriptionStatus, NoSubscription, Active, ActivationLimitReached, Expired, Invalid,
EnteredGracePeriod, GracePeriodOver, NoInternetConnection, UnknownError)

namespace Ui {
class MainWindow;
}
Expand Down Expand Up @@ -127,7 +135,9 @@ public slots:
void toggleEditorSettings();
void setEditorSettingsFromQuickViewVisibility(bool isVisible);
void setEditorSettingsScrollBarPosition(double position);
void setActivationSuccessful();
void setActivationSuccessful(QString licenseKey, bool removeGracePeriodStartedDate = true);
void checkProVersion();
QVariant getUserLicenseKey();

protected:
void paintEvent(QPaintEvent *event) override;
Expand Down Expand Up @@ -244,6 +254,23 @@ public slots:
bool m_isEditorSettingsFromQuickViewVisible;
bool m_isProVersionActivated;
QSettings *m_localLicenseData;
QJsonObject m_paymentDetails;
SubscriptionStatus::Value m_subscriptionStatus;
QQuickView m_subscriptionWindowQuickView;
QWidget *m_subscriptionWindowWidget;
QQmlApplicationEngine m_subscriptionWindowEngine;
QWindow *m_subscriptionWindow;
QString m_purchaseDataAlt1;
QString m_purchaseDataAlt2;
QByteArray *m_dataBuffer;
QNetworkAccessManager *m_netManager;
QNetworkRequest m_reqAlt1;
QNetworkRequest m_reqAlt2;
QNetworkReply *m_netPurchaseDataReplyFirstAttempt;
QNetworkReply *m_netPurchaseDataReplySecondAttempt;
QString m_userLicenseKey;
QMenu m_mainMenu;
QAction *m_buyOrManageSubscriptionAction;

bool alreadyAppliedFormat(const QString &formatChars);
void applyFormat(const QString &formatChars);
Expand All @@ -258,6 +285,7 @@ public slots:
void autoCheckForUpdates();
#endif
void setupSearchEdit();
void setupSubscrirptionWindow();
void setupEditorSettings();
void setupTextEditStyleSheet(int paddingLeft, int paddingRight);
void alignTextEditText();
Expand All @@ -267,6 +295,7 @@ public slots:
#endif
void setupDatabases();
void setupModelView();
void setupGlobalSettingsMenu();
void initializeSettingsDatabase();
void setLayoutForScrollArea();
void setButtonsAndFieldsEnabled(bool doEnable);
Expand All @@ -286,7 +315,9 @@ public slots:
void fillRectWithGradient(QPainter &painter, QRect rect, QGradient &gradient);
double gaussianDist(double x, const double center, double sigma) const;
void resizeAndPositionEditorSettingsWindow();
void checkProVersion();
void getPaymentDetailsSignalsSlots();
void verifyLicenseSignalsSlots();
void getSubscriptionStatus();

void setMargins(QMargins margins);

Expand Down Expand Up @@ -340,6 +371,7 @@ private slots:
void selectAllNotesInList();
void updateFrame();
bool isTitleBar(int x, int y) const;
void openSubscriptionWindow();

signals:
void requestNodesTree();
Expand All @@ -363,6 +395,10 @@ private slots:
void toggleEditorSettingsKeyboardShorcutFired();
void editorSettingsScrollBarPositionChanged(QVariant data);
void proVersionCheck(QVariant data);
void tryPurchaseDataSecondAlternative();
void fetchingPaymentDetailsRemotelyFinished();
void gettingPaymentDetailsFinished();
void subscriptionStatusChanged(QVariant subscriptionStatus);
};

#endif // MAINWINDOW_H
3 changes: 3 additions & 0 deletions src/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
<file>qml/TodoTaskDelegate.qml</file>
<file>qml/ViewChooserButton.qml</file>
<file>qml/EditorSettingsQt512.qml</file>
<file>qml/SubscriptionWindow.qml</file>
<file>qml/CustomTextField.qml</file>
<file>qml/Utilities.js</file>
</qresource>
</RCC>
1 change: 1 addition & 0 deletions src/qml/FontIconsCodes.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ QtObject {
readonly property string fa_linux : "\uf17c"
readonly property string fa_bell : "\uf0f3"
readonly property string fa_circle_check : "\uf058"
readonly property string fa_face_sad_tear : "\uf5b4"

readonly property string mt_view_kanban : "\ueb7f"
readonly property string mt_article : "\uef42"
Expand Down
Loading

0 comments on commit a8d4dc6

Please sign in to comment.