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
|
2017-01-11 18:31:31 +00:00
|
|
|
Copyright (c) 2014-2017 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-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 MainWidget;
|
2016-08-16 16:53:10 +00:00
|
|
|
class LayerStackWidget;
|
2016-12-13 17:07:56 +00:00
|
|
|
class BoxContent;
|
2016-10-02 09:30:28 +00:00
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
namespace Intro {
|
|
|
|
class Widget;
|
|
|
|
} // namespace Intro
|
|
|
|
|
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-11-02 14:44:33 +00:00
|
|
|
namespace Window {
|
|
|
|
namespace Theme {
|
|
|
|
struct BackgroundUpdate;
|
|
|
|
class WarningWidget;
|
|
|
|
} // namespace Theme
|
|
|
|
} // namespace Window
|
|
|
|
|
2016-11-11 13:46:04 +00:00
|
|
|
namespace Ui {
|
|
|
|
class LinkButton;
|
|
|
|
} // namespace Ui
|
|
|
|
|
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:
|
|
|
|
QString _text;
|
2016-12-13 17:07:56 +00:00
|
|
|
int _textWidth = 0;
|
|
|
|
object_ptr<Ui::LinkButton> _reconnect;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
|
|
|
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);
|
2016-12-13 07:59:57 +00:00
|
|
|
void serviceNotification(const TextWithEntities &message, const MTPMessageMedia &media = MTP_messageMediaEmpty(), int32 date = 0, bool force = false);
|
|
|
|
void serviceNotificationLocal(QString text);
|
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);
|
|
|
|
|
|
|
|
MainWidget *mainWidget();
|
2015-03-02 12:34:16 +00:00
|
|
|
PasscodeWidget *passcodeWidget();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-01-01 16:45:20 +00:00
|
|
|
bool doWeReadServerHistory();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void activate();
|
|
|
|
|
2016-11-24 19:28:23 +00:00
|
|
|
void noIntro(Intro::Widget *was);
|
2014-05-30 08:53:19 +00:00
|
|
|
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();
|
|
|
|
|
2017-01-01 16:45:20 +00:00
|
|
|
void changingMsgId(HistoryItem *row, MsgId newId) override;
|
2015-01-26 13:04:41 +00:00
|
|
|
|
2016-12-23 13:21:01 +00:00
|
|
|
QImage iconWithCounter(int size, int count, style::color bg, 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-11-11 19:51:59 +00:00
|
|
|
void showMainMenu();
|
2017-01-01 16:45:20 +00:00
|
|
|
void updateTrayMenu(bool force = false) override;
|
2016-11-11 19:51:59 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
void ui_showBox(object_ptr<BoxContent> 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();
|
2016-04-10 18:18:26 +00:00
|
|
|
void ui_showMediaPreview(DocumentData *document);
|
|
|
|
void ui_showMediaPreview(PhotoData *photo);
|
|
|
|
void ui_hideMediaPreview();
|
2017-01-01 16:45:20 +00:00
|
|
|
PeerData *ui_getPeerForMouseAction() override;
|
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;
|
2017-01-01 16:45:20 +00:00
|
|
|
void updateIsActiveHook() override;
|
|
|
|
void clearWidgetsHook() override;
|
2016-11-07 15:24:28 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
public slots:
|
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);
|
|
|
|
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-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();
|
|
|
|
|
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);
|
2016-12-13 07:59:57 +00:00
|
|
|
void checkNewAuthorization();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-06-16 15:17:39 +00:00
|
|
|
private slots:
|
|
|
|
void onStateChanged(Qt::WindowState state);
|
|
|
|
|
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-12-23 13:21:01 +00:00
|
|
|
void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, 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
|
|
|
|
2016-12-13 07:59:57 +00:00
|
|
|
struct DelayedServiceMsg {
|
|
|
|
DelayedServiceMsg(const TextWithEntities &message, const MTPMessageMedia &media, int32 date) : message(message), media(media), date(date) {
|
|
|
|
}
|
|
|
|
TextWithEntities message;
|
|
|
|
MTPMessageMedia media;
|
|
|
|
int32 date;
|
|
|
|
};
|
|
|
|
QList<DelayedServiceMsg> _delayedServiceMsgs;
|
2016-04-10 18:18:26 +00:00
|
|
|
mtpRequestId _serviceHistoryRequest = 0;
|
2014-12-12 16:27:03 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<PasscodeWidget> _passcode = { nullptr };
|
|
|
|
object_ptr<Intro::Widget> _intro = { nullptr };
|
|
|
|
object_ptr<MainWidget> _main = { nullptr };
|
|
|
|
object_ptr<LayerStackWidget> _layerBg = { nullptr };
|
|
|
|
object_ptr<MediaPreviewWidget> _mediaPreview = { nullptr };
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<ConnectingWidget> _connecting = { nullptr };
|
|
|
|
object_ptr<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
|
|
|
|
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-12-01 19:20:33 +00:00
|
|
|
TimeMs _shouldLockAt = 0;
|
2015-03-02 12:34:16 +00:00
|
|
|
|
2016-12-01 19:20:33 +00:00
|
|
|
using NotifyWhenMap = QMap<MsgId, TimeMs>;
|
2016-10-02 13:54:27 +00:00
|
|
|
using NotifyWhenMaps = QMap<History*, NotifyWhenMap>;
|
|
|
|
NotifyWhenMaps _notifyWhenMaps;
|
2014-07-06 03:32:21 +00:00
|
|
|
struct NotifyWaiter {
|
2016-12-01 19:20:33 +00:00
|
|
|
NotifyWaiter(MsgId msg, TimeMs when, PeerData *notifyByFrom)
|
2016-10-02 13:54:27 +00:00
|
|
|
: msg(msg)
|
|
|
|
, when(when)
|
|
|
|
, notifyByFrom(notifyByFrom) {
|
2014-07-06 03:32:21 +00:00
|
|
|
}
|
|
|
|
MsgId msg;
|
2016-12-01 19:20:33 +00:00
|
|
|
TimeMs 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-12-01 19:20:33 +00:00
|
|
|
using NotifyWhenAlert = QMap<TimeMs, PeerData*>;
|
2016-10-02 13:54:27 +00:00
|
|
|
using NotifyWhenAlerts = QMap<History*, NotifyWhenAlert>;
|
|
|
|
NotifyWhenAlerts _notifyWhenAlerts;
|
2014-07-06 03:32:21 +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
|