-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmainwindow.h
82 lines (71 loc) · 2.74 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
Copyright (c) 2013 by Ruslan Nazarov <818151@gmail.com>
***************************************************************************
* *
* This program 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. *
* *
***************************************************************************
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QQmlContext>
#include <QTranslator>
#include <QFontDatabase>
#include <QScreen>
#include <QDebug>
#include "qtquick2applicationviewer.h"
#include "cache/networkaccessmanagerfactory.h"
#include "vk/client.h"
#include "authorization.h"
#include "chat/dialogshandler.h"
#include "roster/rosterhandler.h"
#include "chat/chats.h"
#include "notification/notificator.h"
#include "audio/audio.h"
class MainWindow : public QtQuick2ApplicationViewer
{
Q_OBJECT
Q_PROPERTY(int fontPointSize READ fontPointSize WRITE setFontPointSize NOTIFY fontPointSizeChanged)
Q_PROPERTY(QString initialItem READ initialItem CONSTANT)
public:
explicit MainWindow(QWindow *parent = 0);
~MainWindow();
void showExpanded();
int fontPointSize() const;
void setFontPointSize(const int fontPointSize);
QString initialItem() const;
Q_INVOKABLE QPoint positionGlobalCenter(const int width, const int height) const;
Q_INVOKABLE QPoint positionGlobalCursor() const;
Q_INVOKABLE QPoint mapToGlobal(const int x, const int y) const;
protected:
void setDefaultFont();
private:
QTranslator *translator;
Authorization *authorization;
DialogsHandler *dialogsHandler;
RosterHandler *rosterHandler;
QString _initialItem;
int _fontPointSize;
public slots:
void showAuthPage();
void showMainPage();
void dialogCurrentIndexChanged(const int i);
void rosterCurrentIndexChanged(const int i);
void openChat(const int uid, const bool setCurrent=true);
private slots:
void notificationClicked(const int peer, const int mid);
void notificationReplied(const int peer, const int mid, const QString &response);
void onActiveChanged();
void onAuthorized(const int uid, const QString &token, const QString &secret);
void onLogout(const int uid);
void onError(const ErrorResponse::Error &error, const QString &text, const bool global, const bool fatal);
void onLongPollStarted();
void onLongPollStopped();
void onRebuild();
signals:
void fontPointSizeChanged();
};
#endif // MAINWINDOW_H