some winrt macro changes

This commit is contained in:
John Preston 2016-03-20 21:34:20 +03:00
parent 27856d830b
commit a2f5acdff1
10 changed files with 2059 additions and 2611 deletions

View File

@ -107,6 +107,7 @@ void AboutBox::paintEvent(QPaintEvent *e) {
paintTitle(p, qsl("Telegram Desktop"));
}
#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
QString _getCrashReportFile(const QMimeData *m) {
if (!m || m->urls().size() != 1) return QString();
@ -115,19 +116,24 @@ QString _getCrashReportFile(const QMimeData *m) {
return file.endsWith(qstr(".telegramcrash"), Qt::CaseInsensitive) ? file : QString();
}
#endif // !TDESKTOP_DISABLE_CRASH_REPORTS
void AboutBox::dragEnterEvent(QDragEnterEvent *e) {
#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
if (!_getCrashReportFile(e->mimeData()).isEmpty()) {
e->setDropAction(Qt::CopyAction);
e->accept();
}
#endif
}
void AboutBox::dropEvent(QDropEvent *e) {
#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
if (!_getCrashReportFile(e->mimeData()).isEmpty()) {
e->acceptProposedAction();
showCrashReportWindow(_getCrashReportFile(e->mimeData()));
}
#endif // !TDESKTOP_DISABLE_CRASH_REPORTS
}
QString telegramFaqLink() {

View File

@ -149,7 +149,7 @@ bool _filedialogGetFiles(QStringList &files, QByteArray &remoteContent, const QS
cSetDialogLastPath(path);
Local::writeUserSettings();
}
if (res == QDialog::Accepted) {
if (multipleFiles > 0) {
files = dialog.selectedFiles();
@ -157,9 +157,9 @@ bool _filedialogGetFiles(QStringList &files, QByteArray &remoteContent, const QS
files = dialog.selectedFiles().mid(0, 1);
}
if (multipleFiles >= 0) {
#ifdef Q_OS_WIN
#if defined Q_OS_WIN && !defined Q_OS_WINRT
remoteContent = dialog.selectedRemoteContent();
#endif
#endif // Q_OS_WIN && !Q_OS_WINRT
}
return true;
}

View File

@ -1654,6 +1654,7 @@ public:
*_getSymbolUpon = true;
return false;
} else if (_p) {
#ifndef TDESKTOP_WINRT // temp
QTextCharFormat format;
QTextItemInt gf(glyphs.mid(glyphsStart, glyphsEnd - glyphsStart),
&_e->fnt, engine.layoutData->string.unicode() + itemStart,
@ -1662,7 +1663,7 @@ public:
gf.width = itemWidth;
gf.justified = false;
gf.initWithScriptItem(si);
#endif // !TDESKTOP_WINRT
if (_localFrom + itemStart < _selectedTo && _localFrom + itemEnd > _selectedFrom) {
QFixed selX = x, selWidth = itemWidth;
if (_localFrom + itemEnd > _selectedTo || _localFrom + itemStart < _selectedFrom) {
@ -1703,7 +1704,9 @@ public:
_p->fillRect(QRectF(selX.toReal(), _y + _yDelta, selWidth.toReal(), _fontHeight), _textStyle->selectBg->b);
}
#ifndef TDESKTOP_WINRT // temp
_p->drawTextItem(QPointF(x.toReal(), textY), gf);
#endif // !TDESKTOP_WINRT
}
x += itemWidth;

View File

@ -30,8 +30,10 @@ int main(int argc, char *argv[]) {
return psFixPrevious();
} else if (cLaunchMode() == LaunchModeCleanup) {
return psCleanup();
#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
} else if (cLaunchMode() == LaunchModeShowCrash) {
return showCrashReportWindow(QFileInfo(cStartUrl()).absoluteFilePath());
#endif // !TDESKTOP_DISABLE_CRASH_REPORTS
}
// both are finished in Application::closeApplication
@ -72,4 +74,6 @@ int main(int argc, char *argv[]) {
SignalHandlers::finish();
PlatformSpecific::finish();
Logs::finish();
return result;
}

File diff suppressed because it is too large Load Diff

View File

@ -104,7 +104,7 @@ protected:
private:
HWND ps_hWnd;
HWND ps_tbHider_hWnd;
// HWND ps_tbHider_hWnd;
HMENU ps_menu;
HICON ps_iconBig, ps_iconSmall, ps_iconOverlay;
@ -115,7 +115,6 @@ private:
void psWriteDump();
void psWriteStackTrace();
QString psPrepareCrashDump(const QByteArray &crashdump, QString dumpfile);
void psDeleteDir(const QString &dir);

View File

@ -21,10 +21,13 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h"
#include <QtCore/QtPlugin>
#ifdef Q_OS_WIN
#ifdef Q_OS_WINRT
//Q_IMPORT_PLUGIN(QWinRTIntegrationPlugin)
//Q_IMPORT_PLUGIN(QWbmpPlugin)
#elif defined Q_OS_WIN // Q_OS_WINRT
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin)
#elif defined Q_OS_MAC
#elif defined Q_OS_MAC // Q_OS_WIN
Q_IMPORT_PLUGIN(QGenericEnginePlugin)
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
Q_IMPORT_PLUGIN(QDDSPlugin)
@ -36,7 +39,7 @@ Q_IMPORT_PLUGIN(QTgaPlugin)
Q_IMPORT_PLUGIN(QTiffPlugin)
Q_IMPORT_PLUGIN(QWbmpPlugin)
Q_IMPORT_PLUGIN(QWebpPlugin)
#elif defined Q_OS_LINUX
#elif defined Q_OS_LINUX // Q_OS_LINUX
Q_IMPORT_PLUGIN(QComposePlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QIbusPlatformInputContextPlugin)
Q_IMPORT_PLUGIN(QFcitxPlatformInputContextPlugin)

View File

@ -18,11 +18,20 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
#ifdef TDESKTOP_WINRT
#include <wrl.h>
#include <wrl/client.h>
#else // TDESKTOP_WINRT
#define __HUGE
#define PSAPI_VERSION 1 // fix WinXP
#define __STDC_FORMAT_MACROS // fix breakpad for mac
#endif // else of TDESKTOP_WINRT
#ifdef __cplusplus
#include <numeric>
@ -43,9 +52,9 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#ifdef Q_OS_WIN // use Lzma SDK for win
#include <LzmaLib.h>
#else
#else // Q_OS_WIN
#include <lzma.h>
#endif
#endif // else of Q_OS_WIN
extern "C" {

View File

@ -82,9 +82,9 @@ NotifyWindow::NotifyWindow(HistoryItem *msg, int32 x, int32 y, int32 fwdCount) :
, history(msg->history())
, item(msg)
, fwdCount(fwdCount)
#ifdef Q_OS_WIN
#if defined Q_OS_WIN && !defined Q_OS_WINRT
, started(GetTickCount())
#endif
#endif // Q_OS_WIN && !Q_OS_WINRT
, close(this, st::notifyClose)
, alphaDuration(st::notifyFastAnim)
, posDuration(st::notifyFastAnim)
@ -126,7 +126,7 @@ NotifyWindow::NotifyWindow(HistoryItem *msg, int32 x, int32 y, int32 fwdCount) :
}
void NotifyWindow::checkLastInput() {
#ifdef Q_OS_WIN
#if defined Q_OS_WIN && !defined Q_OS_WINRT
LASTINPUTINFO lii;
lii.cbSize = sizeof(LASTINPUTINFO);
BOOL res = GetLastInputInfo(&lii);
@ -135,14 +135,14 @@ void NotifyWindow::checkLastInput() {
} else {
inputTimer.start(300);
}
#else
#else // Q_OS_WIN && !Q_OS_WINRT
// TODO
if (true) {
hideTimer.start(st::notifyWaitLongHide);
} else {
inputTimer.start(300);
}
#endif
#endif // else for Q_OS_WIN && !Q_OS_WINRT
}
void NotifyWindow::moveTo(int32 x, int32 y, int32 index) {
@ -3096,6 +3096,7 @@ void ShowCrashReportWindow::closeEvent(QCloseEvent *e) {
deleteLater();
}
#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
int showCrashReportWindow(const QString &crashdump) {
QString text;
@ -3120,3 +3121,4 @@ int showCrashReportWindow(const QString &crashdump) {
ShowCrashReportWindow *wnd = new ShowCrashReportWindow(text);
return app.exec();
}
#endif // !TDESKTOP_DISABLE_CRASH_REPORTS

View File

@ -98,9 +98,9 @@ public slots:
private:
#ifdef Q_OS_WIN
#if defined Q_OS_WIN && !defined Q_OS_WINRT
DWORD started;
#endif
#endif // Q_OS_WIN && !Q_OS_WINRT
History *history;
HistoryItem *item;
int32 fwdCount;
@ -573,4 +573,6 @@ private:
};
#ifndef TDESKTOP_DISABLE_CRASH_REPORTS
int showCrashReportWindow(const QString &crashdump);
#endif // !TDESKTOP_DISABLE_CRASH_REPORTS