2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 10:47:38 +00:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
Telegram Desktop 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.
|
|
|
|
|
|
|
|
It 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.
|
|
|
|
|
2015-10-03 13:16:42 +00:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 10:56:18 +00:00
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
2016-01-30 16:31:10 +00:00
|
|
|
#pragma once
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
#include "title.h"
|
|
|
|
#include "pspecific.h"
|
2016-04-07 18:05:28 +00:00
|
|
|
#include "ui/boxshadow.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-08-06 14:40:21 +00:00
|
|
|
class MediaView;
|
2014-05-30 08:53:19 +00:00
|
|
|
class TitleWidget;
|
2015-03-02 12:34:16 +00:00
|
|
|
class PasscodeWidget;
|
2014-05-30 08:53:19 +00:00
|
|
|
class IntroWidget;
|
|
|
|
class MainWidget;
|
2014-08-01 11:09:46 +00:00
|
|
|
class SettingsWidget;
|
2014-05-30 08:53:19 +00:00
|
|
|
class BackgroundWidget;
|
|
|
|
class LayeredWidget;
|
2014-11-22 09:45:04 +00:00
|
|
|
namespace Local {
|
|
|
|
class ClearManager;
|
|
|
|
}
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
class ConnectingWidget : public QWidget {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect);
|
|
|
|
void set(const QString &text, const QString &reconnect);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onReconnect();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
BoxShadow _shadow;
|
|
|
|
QString _text;
|
|
|
|
int32 _textWidth;
|
|
|
|
LinkButton _reconnect;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-12-08 12:33:37 +00:00
|
|
|
class NotifyWindow : public TWidget {
|
2014-07-06 03:32:21 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2015-04-23 15:50:11 +00:00
|
|
|
NotifyWindow(HistoryItem *item, int32 x, int32 y, int32 fwdCount);
|
2014-07-06 03:32:21 +00:00
|
|
|
|
|
|
|
void enterEvent(QEvent *e);
|
|
|
|
void leaveEvent(QEvent *e);
|
|
|
|
void mousePressEvent(QMouseEvent *e);
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
|
2015-12-08 12:33:37 +00:00
|
|
|
void step_appearance(float64 ms, bool timer);
|
2014-07-06 03:32:21 +00:00
|
|
|
void animHide(float64 duration, anim::transition func);
|
|
|
|
void startHiding();
|
|
|
|
void stopHiding();
|
|
|
|
void moveTo(int32 x, int32 y, int32 index = -1);
|
|
|
|
|
2014-07-18 10:37:34 +00:00
|
|
|
void updateNotifyDisplay();
|
2014-07-06 03:32:21 +00:00
|
|
|
void updatePeerPhoto();
|
|
|
|
|
2014-07-18 10:37:34 +00:00
|
|
|
void itemRemoved(HistoryItem *del);
|
|
|
|
|
2014-07-06 03:32:21 +00:00
|
|
|
int32 index() const {
|
|
|
|
return history ? _index : -1;
|
|
|
|
}
|
|
|
|
|
2014-11-23 11:20:40 +00:00
|
|
|
void unlinkHistory(History *hist = 0);
|
|
|
|
|
2014-07-06 03:32:21 +00:00
|
|
|
~NotifyWindow();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void hideByTimer();
|
|
|
|
void checkLastInput();
|
|
|
|
|
2014-11-23 11:20:40 +00:00
|
|
|
void unlinkHistoryAndNotify();
|
2014-07-06 03:32:21 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2016-03-20 18:34:20 +00:00
|
|
|
#if defined Q_OS_WIN && !defined Q_OS_WINRT
|
2014-07-06 03:32:21 +00:00
|
|
|
DWORD started;
|
2016-03-20 18:34:20 +00:00
|
|
|
#endif // Q_OS_WIN && !Q_OS_WINRT
|
2014-07-06 03:32:21 +00:00
|
|
|
History *history;
|
2014-07-18 10:37:34 +00:00
|
|
|
HistoryItem *item;
|
2015-04-23 15:50:11 +00:00
|
|
|
int32 fwdCount;
|
2014-07-06 03:32:21 +00:00
|
|
|
IconedButton close;
|
|
|
|
QPixmap pm;
|
|
|
|
float64 alphaDuration, posDuration;
|
|
|
|
QTimer hideTimer, inputTimer;
|
|
|
|
bool hiding;
|
|
|
|
int32 _index;
|
2015-12-08 12:33:37 +00:00
|
|
|
anim::fvalue a_opacity;
|
|
|
|
anim::transition a_func;
|
|
|
|
anim::ivalue a_y;
|
|
|
|
Animation _a_appearance;
|
|
|
|
|
2014-07-06 03:32:21 +00:00
|
|
|
ImagePtr peerPhoto;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef QList<NotifyWindow*> NotifyWindows;
|
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
class MediaPreviewWidget;
|
2016-02-17 16:37:21 +00:00
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
class MainWindow : public PsMainWindow {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-04-12 21:31:28 +00:00
|
|
|
MainWindow(QWidget *parent = 0);
|
|
|
|
~MainWindow();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void init();
|
2014-09-29 02:47:30 +00:00
|
|
|
void firstShow();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-08-11 09:03:45 +00:00
|
|
|
QWidget *filedialogParent();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
bool eventFilter(QObject *obj, QEvent *evt);
|
|
|
|
|
|
|
|
void inactivePress(bool inactive);
|
|
|
|
bool inactivePress() const;
|
|
|
|
|
|
|
|
void wStartDrag(QMouseEvent *e);
|
|
|
|
void mouseMoveEvent(QMouseEvent *e);
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e);
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
|
|
|
|
void paintEvent(QPaintEvent *e);
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
2016-02-08 14:54:55 +00:00
|
|
|
void updateAdaptiveLayout();
|
2014-12-12 16:27:03 +00:00
|
|
|
bool needBackButton();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-03-02 12:34:16 +00:00
|
|
|
void setupPasscode(bool anim);
|
|
|
|
void clearPasscode();
|
|
|
|
void checkAutoLockIn(int msec);
|
2014-05-30 08:53:19 +00:00
|
|
|
void setupIntro(bool anim);
|
2015-03-02 12:34:16 +00:00
|
|
|
void setupMain(bool anim, const MTPUser *user = 0);
|
2014-05-30 08:53:19 +00:00
|
|
|
void getNotifySetting(const MTPInputNotifyPeer &peer, uint32 msWait = 0);
|
2015-09-20 08:55:41 +00:00
|
|
|
void serviceNotification(const QString &msg, const MTPMessageMedia &media = MTP_messageMediaEmpty(), bool force = false);
|
2014-12-12 16:27:03 +00:00
|
|
|
void sendServiceHistoryRequest();
|
|
|
|
void showDelayedServiceMsgs();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void mtpStateChanged(int32 dc, int32 state);
|
|
|
|
|
|
|
|
TitleWidget *getTitle();
|
|
|
|
|
|
|
|
HitTestType hitTest(const QPoint &p) const;
|
|
|
|
QRect iconRect() const;
|
|
|
|
|
|
|
|
QRect clientRect() const;
|
|
|
|
QRect photoRect() const;
|
2016-01-25 10:22:58 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
IntroWidget *introWidget();
|
|
|
|
MainWidget *mainWidget();
|
2014-08-01 11:09:46 +00:00
|
|
|
SettingsWidget *settingsWidget();
|
2015-03-02 12:34:16 +00:00
|
|
|
PasscodeWidget *passcodeWidget();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void showConnecting(const QString &text, const QString &reconnect = QString());
|
|
|
|
void hideConnecting();
|
2014-10-22 18:39:03 +00:00
|
|
|
bool connectingVisible() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
void showPhoto(const PhotoOpenClickHandler *lnk, HistoryItem *item = 0);
|
2014-08-11 09:03:45 +00:00
|
|
|
void showPhoto(PhotoData *photo, HistoryItem *item);
|
|
|
|
void showPhoto(PhotoData *photo, PeerData *item);
|
2015-04-11 10:04:10 +00:00
|
|
|
void showDocument(DocumentData *doc, HistoryItem *item);
|
2015-10-27 02:39:02 +00:00
|
|
|
|
2015-01-26 13:04:41 +00:00
|
|
|
bool historyIsActive() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void activate();
|
|
|
|
|
|
|
|
void noIntro(IntroWidget *was);
|
2014-08-01 11:09:46 +00:00
|
|
|
void noSettings(SettingsWidget *was);
|
2014-05-30 08:53:19 +00:00
|
|
|
void noMain(MainWidget *was);
|
|
|
|
void noBox(BackgroundWidget *was);
|
2014-12-12 16:27:03 +00:00
|
|
|
void layerFinishedHide(BackgroundWidget *was);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void fixOrder();
|
|
|
|
|
|
|
|
enum TempDirState {
|
|
|
|
TempDirRemoving,
|
|
|
|
TempDirExists,
|
|
|
|
TempDirEmpty,
|
|
|
|
};
|
|
|
|
TempDirState tempDirState();
|
2015-01-02 14:55:24 +00:00
|
|
|
TempDirState localStorageState();
|
2014-11-22 09:45:04 +00:00
|
|
|
void tempDirDelete(int task);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-07-06 03:32:21 +00:00
|
|
|
void notifySettingGot();
|
2015-03-19 09:18:19 +00:00
|
|
|
void notifySchedule(History *history, HistoryItem *item);
|
2014-07-06 03:32:21 +00:00
|
|
|
void notifyClear(History *history = 0);
|
|
|
|
void notifyClearFast();
|
|
|
|
void notifyShowNext(NotifyWindow *remove = 0);
|
2014-07-18 10:37:34 +00:00
|
|
|
void notifyItemRemoved(HistoryItem *item);
|
2014-07-06 03:32:21 +00:00
|
|
|
void notifyStopHiding();
|
|
|
|
void notifyStartHiding();
|
|
|
|
void notifyUpdateAll();
|
|
|
|
void notifyActivateAll();
|
|
|
|
|
2015-01-15 14:22:15 +00:00
|
|
|
QImage iconLarge() const;
|
2014-07-18 10:37:34 +00:00
|
|
|
|
|
|
|
void sendPaths();
|
|
|
|
|
2015-07-03 08:47:16 +00:00
|
|
|
void mediaOverviewUpdated(PeerData *peer, MediaOverviewType type);
|
2015-04-19 10:29:19 +00:00
|
|
|
void documentUpdated(DocumentData *doc);
|
2014-08-11 09:03:45 +00:00
|
|
|
void changingMsgId(HistoryItem *row, MsgId newId);
|
|
|
|
|
2015-01-26 13:04:41 +00:00
|
|
|
bool isActive(bool cached = true) const;
|
2015-05-20 19:28:24 +00:00
|
|
|
void hideMediaview();
|
2015-01-26 13:04:41 +00:00
|
|
|
|
2015-10-01 14:05:05 +00:00
|
|
|
bool contentOverlapped(const QRect &globalRect);
|
|
|
|
bool contentOverlapped(QWidget *w, QPaintEvent *e) {
|
|
|
|
return contentOverlapped(QRect(w->mapToGlobal(e->rect().topLeft()), e->rect().size()));
|
|
|
|
}
|
|
|
|
bool contentOverlapped(QWidget *w, const QRegion &r) {
|
|
|
|
return contentOverlapped(QRect(w->mapToGlobal(r.boundingRect().topLeft()), r.boundingRect().size()));
|
|
|
|
}
|
|
|
|
|
2015-12-22 08:01:02 +00:00
|
|
|
void ui_showLayer(LayeredWidget *box, ShowLayerOptions options);
|
|
|
|
bool ui_isLayerShown();
|
2015-12-25 13:09:14 +00:00
|
|
|
bool ui_isMediaViewShown();
|
2016-04-10 18:18:26 +00:00
|
|
|
void ui_showMediaPreview(DocumentData *document);
|
|
|
|
void ui_showMediaPreview(PhotoData *photo);
|
|
|
|
void ui_hideMediaPreview();
|
2016-03-29 17:17:00 +00:00
|
|
|
PeerData *ui_getPeerForMouseAction();
|
2015-12-22 08:01:02 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
public slots:
|
2015-01-26 13:04:41 +00:00
|
|
|
|
|
|
|
void updateIsActive(int timeout = 0);
|
|
|
|
void stateChanged(Qt::WindowState state);
|
2016-01-25 10:22:58 +00:00
|
|
|
|
2015-01-26 13:04:41 +00:00
|
|
|
void checkHistoryActivation();
|
2014-12-15 15:55:45 +00:00
|
|
|
void updateCounter();
|
2015-03-02 12:34:16 +00:00
|
|
|
|
|
|
|
void checkAutoLock();
|
2016-01-25 10:22:58 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void showSettings();
|
2014-12-15 15:55:45 +00:00
|
|
|
void hideSettings(bool fast = false);
|
2014-05-30 08:53:19 +00:00
|
|
|
void layerHidden();
|
2015-03-02 12:34:16 +00:00
|
|
|
void setInnerFocus();
|
2014-05-30 08:53:19 +00:00
|
|
|
void updateTitleStatus();
|
2014-09-26 23:48:19 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void quitFromTray();
|
|
|
|
void showFromTray(QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Unknown);
|
2014-09-26 23:48:19 +00:00
|
|
|
bool minimizeToTray();
|
2014-05-30 08:53:19 +00:00
|
|
|
void toggleTray(QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Unknown);
|
2015-02-04 06:14:20 +00:00
|
|
|
void toggleDisplayNotifyFromTray();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void onInactiveTimer();
|
|
|
|
|
2014-11-22 09:45:04 +00:00
|
|
|
void onClearFinished(int task, void *manager);
|
|
|
|
void onClearFailed(int task, void *manager);
|
2014-07-06 03:32:21 +00:00
|
|
|
|
|
|
|
void notifyFire();
|
2014-09-29 02:47:30 +00:00
|
|
|
void updateTrayMenu(bool force = false);
|
2014-09-26 23:48:19 +00:00
|
|
|
|
2014-11-25 12:15:29 +00:00
|
|
|
void onShowAddContact();
|
2014-11-18 12:40:43 +00:00
|
|
|
void onShowNewGroup();
|
2015-09-21 20:57:42 +00:00
|
|
|
void onShowNewChannel();
|
2014-11-18 12:40:43 +00:00
|
|
|
void onLogout();
|
|
|
|
void onLogoutSure();
|
|
|
|
void updateGlobalMenu(); // for OS X top menu
|
|
|
|
|
2014-12-15 15:55:45 +00:00
|
|
|
QImage iconWithCounter(int size, int count, style::color bg, bool smallIcon);
|
|
|
|
|
2015-05-19 15:46:45 +00:00
|
|
|
void notifyUpdateAllPhotos();
|
|
|
|
|
2016-03-29 17:17:00 +00:00
|
|
|
void app_activateClickHandler(ClickHandlerPtr handler, Qt::MouseButton button);
|
2016-02-16 11:21:39 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void resized(const QSize &size);
|
2014-11-22 09:45:04 +00:00
|
|
|
void tempDirCleared(int task);
|
|
|
|
void tempDirClearFailed(int task);
|
2015-04-02 10:33:19 +00:00
|
|
|
void newAuthorization();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-05-19 15:46:45 +00:00
|
|
|
void imageLoaded();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
2014-09-20 21:31:03 +00:00
|
|
|
|
2015-10-17 14:52:26 +00:00
|
|
|
QPixmap grabInner();
|
|
|
|
|
2014-09-26 23:48:19 +00:00
|
|
|
void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color);
|
2014-11-25 20:33:11 +00:00
|
|
|
QImage icon16, icon32, icon64, iconbig16, iconbig32, iconbig64;
|
2014-09-20 21:31:03 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
QWidget *centralwidget;
|
|
|
|
|
2015-09-20 08:55:41 +00:00
|
|
|
typedef QPair<QString, MTPMessageMedia> DelayedServiceMsg;
|
2014-12-12 16:27:03 +00:00
|
|
|
QVector<DelayedServiceMsg> _delayedServiceMsgs;
|
2016-04-10 18:18:26 +00:00
|
|
|
mtpRequestId _serviceHistoryRequest = 0;
|
2014-12-12 16:27:03 +00:00
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
TitleWidget *title = nullptr;
|
|
|
|
PasscodeWidget *_passcode = nullptr;
|
|
|
|
IntroWidget *intro = nullptr;
|
|
|
|
MainWidget *main = nullptr;
|
|
|
|
SettingsWidget *settings = nullptr;
|
|
|
|
BackgroundWidget *layerBg = nullptr;
|
2016-04-10 19:20:48 +00:00
|
|
|
std_::unique_ptr<MediaPreviewWidget> _mediaPreview;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-01-26 13:04:41 +00:00
|
|
|
QTimer _isActiveTimer;
|
2016-04-10 18:18:26 +00:00
|
|
|
bool _isActive = false;
|
2015-01-26 13:04:41 +00:00
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
ConnectingWidget *_connecting = nullptr;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
Local::ClearManager *_clearManager = nullptr;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void clearWidgets();
|
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
bool dragging = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
QPoint dragStart;
|
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
bool _inactivePress = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
QTimer _inactiveTimer;
|
|
|
|
|
2015-03-02 12:34:16 +00:00
|
|
|
SingleTimer _autoLockTimer;
|
2016-04-10 18:18:26 +00:00
|
|
|
uint64 _shouldLockAt = 0;
|
2015-03-02 12:34:16 +00:00
|
|
|
|
2014-07-06 03:32:21 +00:00
|
|
|
typedef QMap<MsgId, uint64> NotifyWhenMap;
|
|
|
|
typedef QMap<History*, NotifyWhenMap> NotifyWhenMaps;
|
|
|
|
NotifyWhenMaps notifyWhenMaps;
|
|
|
|
struct NotifyWaiter {
|
2015-09-04 13:01:31 +00:00
|
|
|
NotifyWaiter(MsgId msg, uint64 when, PeerData *notifyByFrom) : msg(msg), when(when), notifyByFrom(notifyByFrom) {
|
2014-07-06 03:32:21 +00:00
|
|
|
}
|
|
|
|
MsgId msg;
|
|
|
|
uint64 when;
|
2015-09-04 13:01:31 +00:00
|
|
|
PeerData *notifyByFrom;
|
2014-07-06 03:32:21 +00:00
|
|
|
};
|
|
|
|
typedef QMap<History*, NotifyWaiter> NotifyWaiters;
|
|
|
|
NotifyWaiters notifyWaiters;
|
|
|
|
NotifyWaiters notifySettingWaiters;
|
2014-11-12 20:30:26 +00:00
|
|
|
SingleTimer notifyWaitTimer;
|
2014-07-06 03:32:21 +00:00
|
|
|
|
2015-09-04 13:01:31 +00:00
|
|
|
typedef QMap<uint64, PeerData*> NotifyWhenAlert;
|
2014-07-06 03:32:21 +00:00
|
|
|
typedef QMap<History*, NotifyWhenAlert> NotifyWhenAlerts;
|
|
|
|
NotifyWhenAlerts notifyWhenAlerts;
|
|
|
|
|
|
|
|
NotifyWindows notifyWindows;
|
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
MediaView *_mediaView = nullptr;
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
class PreLaunchWindow : public TWidget {
|
|
|
|
public:
|
|
|
|
|
|
|
|
PreLaunchWindow(QString title = QString());
|
|
|
|
void activate();
|
2016-03-31 14:06:40 +00:00
|
|
|
int basicSize() const {
|
2016-01-30 16:31:10 +00:00
|
|
|
return _size;
|
|
|
|
}
|
|
|
|
~PreLaunchWindow();
|
|
|
|
|
|
|
|
static PreLaunchWindow *instance();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2016-03-31 14:06:40 +00:00
|
|
|
int _size;
|
2016-01-30 16:31:10 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class PreLaunchLabel : public QLabel {
|
|
|
|
public:
|
|
|
|
PreLaunchLabel(QWidget *parent);
|
|
|
|
void setText(const QString &text);
|
|
|
|
};
|
|
|
|
|
|
|
|
class PreLaunchInput : public QLineEdit {
|
|
|
|
public:
|
|
|
|
PreLaunchInput(QWidget *parent, bool password = false);
|
|
|
|
};
|
|
|
|
|
|
|
|
class PreLaunchLog : public QTextEdit {
|
|
|
|
public:
|
|
|
|
PreLaunchLog(QWidget *parent);
|
|
|
|
};
|
|
|
|
|
|
|
|
class PreLaunchButton : public QPushButton {
|
|
|
|
public:
|
|
|
|
PreLaunchButton(QWidget *parent, bool confirm = true);
|
|
|
|
void setText(const QString &text);
|
|
|
|
};
|
|
|
|
|
2016-03-14 09:25:48 +00:00
|
|
|
class PreLaunchCheckbox : public QCheckBox {
|
|
|
|
public:
|
|
|
|
PreLaunchCheckbox(QWidget *parent);
|
|
|
|
void setText(const QString &text);
|
|
|
|
};
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
class NotStartedWindow : public PreLaunchWindow {
|
2016-01-25 10:22:58 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
NotStartedWindow();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
void updateControls();
|
|
|
|
|
|
|
|
PreLaunchLabel _label;
|
|
|
|
PreLaunchLog _log;
|
|
|
|
PreLaunchButton _close;
|
2016-01-25 10:22:58 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
class LastCrashedWindow : public PreLaunchWindow {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2016-01-25 10:22:58 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
LastCrashedWindow();
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onViewReport();
|
|
|
|
void onSaveReport();
|
|
|
|
void onSendReport();
|
|
|
|
void onGetApp();
|
|
|
|
|
|
|
|
void onNetworkSettings();
|
|
|
|
void onNetworkSettingsSaved(QString host, quint32 port, QString username, QString password);
|
|
|
|
void onContinue();
|
|
|
|
|
|
|
|
void onCheckingFinished();
|
|
|
|
void onSendingError(QNetworkReply::NetworkError e);
|
|
|
|
void onSendingFinished();
|
|
|
|
void onSendingProgress(qint64 uploaded, qint64 total);
|
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
void onUpdateRetry();
|
|
|
|
void onUpdateSkip();
|
|
|
|
|
|
|
|
void onUpdateChecking();
|
|
|
|
void onUpdateLatest();
|
|
|
|
void onUpdateDownloading(qint64 ready, qint64 total);
|
|
|
|
void onUpdateReady();
|
|
|
|
void onUpdateFailed();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2016-02-09 16:05:08 +00:00
|
|
|
QString minidumpFileName();
|
2016-01-30 16:31:10 +00:00
|
|
|
void updateControls();
|
|
|
|
|
|
|
|
QString _host, _username, _password;
|
|
|
|
quint32 _port;
|
|
|
|
|
2016-02-13 11:21:03 +00:00
|
|
|
PreLaunchLabel _label, _pleaseSendReport, _yourReportName, _minidump;
|
2016-01-30 16:31:10 +00:00
|
|
|
PreLaunchLog _report;
|
|
|
|
PreLaunchButton _send, _sendSkip, _networkSettings, _continue, _showReport, _saveReport, _getApp;
|
2016-03-14 09:25:48 +00:00
|
|
|
PreLaunchCheckbox _includeUsername;
|
2016-01-30 16:31:10 +00:00
|
|
|
|
|
|
|
QString _minidumpName, _minidumpFull, _reportText;
|
2016-03-14 09:25:48 +00:00
|
|
|
QString _reportUsername, _reportTextNoUsername;
|
|
|
|
QByteArray getCrashReportRaw() const;
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
bool _reportShown, _reportSaved;
|
|
|
|
|
2016-03-14 09:25:48 +00:00
|
|
|
void excludeReportUsername();
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
enum SendingState {
|
|
|
|
SendingNoReport,
|
|
|
|
SendingUpdateCheck,
|
|
|
|
SendingNone,
|
|
|
|
SendingTooOld,
|
|
|
|
SendingTooMany,
|
|
|
|
SendingUnofficial,
|
|
|
|
SendingProgress,
|
|
|
|
SendingUploading,
|
|
|
|
SendingFail,
|
|
|
|
SendingDone,
|
|
|
|
};
|
|
|
|
SendingState _sendingState;
|
|
|
|
|
|
|
|
PreLaunchLabel _updating;
|
|
|
|
qint64 _sendingProgress, _sendingTotal;
|
|
|
|
|
|
|
|
QNetworkAccessManager _sendManager;
|
|
|
|
QNetworkReply *_checkReply, *_sendReply;
|
|
|
|
|
|
|
|
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
|
|
|
PreLaunchButton _updatingCheck, _updatingSkip;
|
|
|
|
enum UpdatingState {
|
|
|
|
UpdatingNone,
|
|
|
|
UpdatingCheck,
|
|
|
|
UpdatingLatest,
|
|
|
|
UpdatingDownload,
|
|
|
|
UpdatingFail,
|
|
|
|
UpdatingReady
|
|
|
|
};
|
|
|
|
UpdatingState _updatingState;
|
|
|
|
QString _newVersionDownload;
|
|
|
|
|
|
|
|
void setUpdatingState(UpdatingState state, bool force = false);
|
|
|
|
void setDownloadProgress(qint64 ready, qint64 total);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
QString getReportField(const QLatin1String &name, const QLatin1String &prefix);
|
|
|
|
void addReportFieldPart(const QLatin1String &name, const QLatin1String &prefix, QHttpMultiPart *multipart);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
class NetworkSettingsWindow : public PreLaunchWindow {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
NetworkSettingsWindow(QWidget *parent, QString host, quint32 port, QString username, QString password);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
void saved(QString host, quint32 port, QString username, QString password);
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void onSave();
|
|
|
|
|
2016-01-25 10:22:58 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
void updateControls();
|
|
|
|
|
|
|
|
PreLaunchLabel _hostLabel, _portLabel, _usernameLabel, _passwordLabel;
|
|
|
|
PreLaunchInput _hostInput, _portInput, _usernameInput, _passwordInput;
|
|
|
|
PreLaunchButton _save, _cancel;
|
|
|
|
|
|
|
|
QWidget *_parent;
|
2016-01-25 10:22:58 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-01-30 16:31:10 +00:00
|
|
|
class ShowCrashReportWindow : public PreLaunchWindow {
|
|
|
|
public:
|
|
|
|
|
|
|
|
ShowCrashReportWindow(const QString &text);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e);
|
2016-01-31 16:13:51 +00:00
|
|
|
void closeEvent(QCloseEvent *e);
|
2016-01-30 16:31:10 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
PreLaunchLog _log;
|
|
|
|
|
|
|
|
};
|
2016-01-31 18:01:43 +00:00
|
|
|
|
2016-03-20 18:34:20 +00:00
|
|
|
#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
|
2016-01-31 18:01:43 +00:00
|
|
|
int showCrashReportWindow(const QString &crashdump);
|
2016-03-20 18:34:20 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_CRASH_REPORTS
|