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 "pspecific.h"
|
2016-10-01 12:34:23 +00:00
|
|
|
#include "ui/effects/rect_shadow.h"
|
2016-06-16 12:59:54 +00:00
|
|
|
#include "platform/platform_main_window.h"
|
2016-10-05 16:56:27 +00:00
|
|
|
#include "core/single_timer.h"
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-08-06 14:40:21 +00:00
|
|
|
class MediaView;
|
2015-03-02 12:34:16 +00:00
|
|
|
class PasscodeWidget;
|
2014-05-30 08:53:19 +00:00
|
|
|
class IntroWidget;
|
|
|
|
class MainWidget;
|
2016-08-16 16:53:10 +00:00
|
|
|
class LayerStackWidget;
|
|
|
|
class LayerWidget;
|
2016-10-02 09:30:28 +00:00
|
|
|
|
2014-11-22 09:45:04 +00:00
|
|
|
namespace Local {
|
2016-08-16 16:53:10 +00:00
|
|
|
class ClearManager;
|
|
|
|
} // namespace Local
|
2016-10-02 09:30:28 +00:00
|
|
|
|
2016-08-17 15:14:08 +00:00
|
|
|
namespace Settings {
|
|
|
|
class Widget;
|
|
|
|
} // namespace Settings
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-11-02 14:44:33 +00:00
|
|
|
namespace Window {
|
|
|
|
namespace Theme {
|
|
|
|
struct BackgroundUpdate;
|
|
|
|
class WarningWidget;
|
|
|
|
} // namespace Theme
|
|
|
|
} // namespace Window
|
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
class ConnectingWidget : public TWidget {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ConnectingWidget(QWidget *parent, const QString &text, const QString &reconnect);
|
|
|
|
void set(const QString &text, const QString &reconnect);
|
2016-11-04 08:23:50 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void onReconnect();
|
|
|
|
|
|
|
|
private:
|
2016-10-01 12:34:23 +00:00
|
|
|
Ui::RectShadow _shadow;
|
2014-05-30 08:53:19 +00:00
|
|
|
QString _text;
|
|
|
|
int32 _textWidth;
|
|
|
|
LinkButton _reconnect;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
class MediaPreviewWidget;
|
2016-02-17 16:37:21 +00:00
|
|
|
|
2016-11-04 11:14:47 +00:00
|
|
|
class MainWindow : public Platform::MainWindow {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2016-06-16 12:59:54 +00:00
|
|
|
MainWindow();
|
2016-04-12 21:31:28 +00:00
|
|
|
~MainWindow();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
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
|
|
|
void inactivePress(bool inactive);
|
|
|
|
bool inactivePress() const;
|
|
|
|
|
2016-11-04 19:50:35 +00:00
|
|
|
void setupPasscode();
|
2015-03-02 12:34:16 +00:00
|
|
|
void clearPasscode();
|
|
|
|
void checkAutoLockIn(int msec);
|
2016-11-04 19:50:35 +00:00
|
|
|
void setupIntro();
|
|
|
|
void setupMain(const MTPUser *user = 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);
|
|
|
|
|
|
|
|
IntroWidget *introWidget();
|
|
|
|
MainWidget *mainWidget();
|
2015-03-02 12:34:16 +00:00
|
|
|
PasscodeWidget *passcodeWidget();
|
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
|
|
|
|
2016-06-03 12:45:33 +00:00
|
|
|
bool doWeReadServerHistory() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void activate();
|
|
|
|
|
|
|
|
void noIntro(IntroWidget *was);
|
|
|
|
void noMain(MainWidget *was);
|
2016-08-16 16:53:10 +00:00
|
|
|
void noLayerStack(LayerStackWidget *was);
|
|
|
|
void layerFinishedHide(LayerStackWidget *was);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
void checkHistoryActivation();
|
|
|
|
|
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
|
|
|
|
2016-09-21 11:44:20 +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 notifyUpdateAll();
|
|
|
|
|
2016-09-21 11:44:20 +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
|
|
|
|
2016-11-06 18:45:50 +00:00
|
|
|
QImage iconWithCounter(int size, int count, const style::color &bg, const style::color &fg, bool smallIcon) override;
|
2016-04-29 13:46:16 +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()));
|
|
|
|
}
|
|
|
|
|
2016-08-16 16:53:10 +00:00
|
|
|
void ui_showLayer(LayerWidget *box, ShowLayerOptions options);
|
2016-08-17 15:14:08 +00:00
|
|
|
void ui_hideSettingsAndLayer(ShowLayerOptions options);
|
2015-12-22 08:01:02 +00:00
|
|
|
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
|
|
|
|
2016-11-04 08:23:50 +00:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *o, QEvent *e) override;
|
|
|
|
void closeEvent(QCloseEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
|
2016-11-07 15:24:28 +00:00
|
|
|
void initHook() override;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
public slots:
|
2015-01-26 13:04:41 +00:00
|
|
|
void updateIsActive(int timeout = 0);
|
2016-01-25 10:22:58 +00:00
|
|
|
|
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();
|
|
|
|
void layerHidden();
|
2015-03-02 12:34:16 +00:00
|
|
|
void setInnerFocus();
|
2016-09-21 11:44:20 +00:00
|
|
|
void updateConnectingStatus();
|
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
|
|
|
|
2016-10-02 13:54:27 +00:00
|
|
|
void notifyShowNext();
|
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
|
|
|
|
|
2016-06-24 16:43:46 +00:00
|
|
|
void onReActivate();
|
|
|
|
|
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:
|
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
|
|
|
|
2016-06-16 15:17:39 +00:00
|
|
|
private slots:
|
|
|
|
void onStateChanged(Qt::WindowState state);
|
2016-08-17 15:14:08 +00:00
|
|
|
void onSettingsDestroyed(QObject *was);
|
2016-06-16 15:17:39 +00:00
|
|
|
|
2016-10-19 12:24:39 +00:00
|
|
|
void onWindowActiveChanged();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
2016-09-21 11:44:20 +00:00
|
|
|
void showConnecting(const QString &text, const QString &reconnect = QString());
|
|
|
|
void hideConnecting();
|
2014-09-20 21:31:03 +00:00
|
|
|
|
2016-11-02 14:44:33 +00:00
|
|
|
void themeUpdated(const Window::Theme::BackgroundUpdate &data);
|
|
|
|
|
2016-10-24 15:36:17 +00:00
|
|
|
void updateControlsGeometry();
|
|
|
|
|
2015-10-17 14:52:26 +00:00
|
|
|
QPixmap grabInner();
|
|
|
|
|
2016-11-06 18:45:50 +00:00
|
|
|
void placeSmallCounter(QImage &img, int size, int count, const style::color &bg, const QPoint &shift, const style::color &color) override;
|
2014-11-25 20:33:11 +00:00
|
|
|
QImage icon16, icon32, icon64, iconbig16, iconbig32, iconbig64;
|
2014-09-20 21:31:03 +00:00
|
|
|
|
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-11-04 08:23:50 +00:00
|
|
|
ChildWidget<PasscodeWidget> _passcode = { nullptr };
|
|
|
|
ChildWidget<IntroWidget> _intro = { nullptr };
|
|
|
|
ChildWidget<MainWidget> _main = { nullptr };
|
|
|
|
ChildWidget<Settings::Widget> _settings = { nullptr };
|
|
|
|
ChildWidget<LayerStackWidget> _layerBg = { nullptr };
|
|
|
|
ChildWidget<MediaPreviewWidget> _mediaPreview = { nullptr };
|
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-09-21 11:44:20 +00:00
|
|
|
ChildWidget<ConnectingWidget> _connecting = { nullptr };
|
2016-11-02 14:44:33 +00:00
|
|
|
ChildWidget<Window::Theme::WarningWidget> _testingThemeWarning = { 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 _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
|
|
|
|
2016-10-02 13:54:27 +00:00
|
|
|
using NotifyWhenMap = QMap<MsgId, uint64>;
|
|
|
|
using NotifyWhenMaps = QMap<History*, NotifyWhenMap>;
|
|
|
|
NotifyWhenMaps _notifyWhenMaps;
|
2014-07-06 03:32:21 +00:00
|
|
|
struct NotifyWaiter {
|
2016-10-02 13:54:27 +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
|
|
|
};
|
2016-10-02 13:54:27 +00:00
|
|
|
using NotifyWaiters = QMap<History*, NotifyWaiter>;
|
|
|
|
NotifyWaiters _notifyWaiters;
|
|
|
|
NotifyWaiters _notifySettingWaiters;
|
|
|
|
SingleTimer _notifyWaitTimer;
|
2014-07-06 03:32:21 +00:00
|
|
|
|
2016-10-02 13:54:27 +00:00
|
|
|
using NotifyWhenAlert = QMap<uint64, PeerData*>;
|
|
|
|
using NotifyWhenAlerts = QMap<History*, NotifyWhenAlert>;
|
|
|
|
NotifyWhenAlerts _notifyWhenAlerts;
|
2014-07-06 03:32:21 +00:00
|
|
|
|
2016-04-10 18:18:26 +00:00
|
|
|
MediaView *_mediaView = nullptr;
|
2016-10-02 09:30:28 +00:00
|
|
|
|
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();
|
2016-10-18 07:56:38 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
2016-01-30 16:31:10 +00:00
|
|
|
|
|
|
|
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);
|
2016-10-18 07:56:38 +00:00
|
|
|
#endif // !TDESKTOP_DISABLE_AUTOUPDATE
|
2016-01-30 16:31:10 +00:00
|
|
|
|
|
|
|
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
|