mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-10 00:57:57 +00:00
Some improvements for winrt.
This commit is contained in:
parent
487406ac46
commit
390a1b0754
@ -16,6 +16,21 @@ index eec9e1f..ec3015e 100644
|
||||
QMAKE_CFLAGS_YACC =
|
||||
QMAKE_CFLAGS_LTCG = -GL
|
||||
QMAKE_CFLAGS_SSE2 = -arch:SSE2
|
||||
diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp
|
||||
index f1a6019..a53a6c4 100644
|
||||
--- a/src/corelib/io/qfilesystemengine_win.cpp
|
||||
+++ b/src/corelib/io/qfilesystemengine_win.cpp
|
||||
@@ -1416,8 +1416,9 @@ bool QFileSystemEngine::copyFile(const QFileSystemEntry &source, const QFileSyst
|
||||
COPYFILE2_EXTENDED_PARAMETERS copyParams = {
|
||||
sizeof(copyParams), COPY_FILE_FAIL_IF_EXISTS, NULL, NULL, NULL
|
||||
};
|
||||
+ // CopyFile2 returns HRESULT, not BOOL, so it should be tested for S_OK, not 0.
|
||||
bool ret = ::CopyFile2((const wchar_t*)source.nativeFilePath().utf16(),
|
||||
- (const wchar_t*)target.nativeFilePath().utf16(), ©Params) != 0;
|
||||
+ (const wchar_t*)target.nativeFilePath().utf16(), ©Params) == S_OK;
|
||||
#endif // Q_OS_WINRT
|
||||
if(!ret)
|
||||
error = QSystemError(::GetLastError(), QSystemError::NativeError);
|
||||
diff --git a/src/corelib/tools/qunicodetables.cpp b/src/corelib/tools/qunicodetables.cpp
|
||||
index 14e4fd1..c31c62b 100644
|
||||
--- a/src/corelib/tools/qunicodetables.cpp
|
||||
@ -84,6 +99,20 @@ index 918c989..55ef783 100644
|
||||
}
|
||||
|
||||
// Make sure we're inside the viewport.
|
||||
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
|
||||
index 39c228f..b72fdc0 100644
|
||||
--- a/src/gui/text/qtextengine_p.h
|
||||
+++ b/src/gui/text/qtextengine_p.h
|
||||
@@ -283,7 +283,8 @@ private:
|
||||
|
||||
struct QScriptItem;
|
||||
/// Internal QTextItem
|
||||
-class QTextItemInt : public QTextItem
|
||||
+// Enable access to QTextItemInt in .dll for WinRT build.
|
||||
+class Q_GUI_EXPORT QTextItemInt : public QTextItem
|
||||
{
|
||||
public:
|
||||
inline QTextItemInt()
|
||||
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
|
||||
index 9e2a23a..861f202 100644
|
||||
--- a/src/gui/text/qtextlayout.cpp
|
||||
|
@ -174,12 +174,15 @@ void Application::socketError(QLocalSocket::LocalSocketError e) {
|
||||
}
|
||||
_localSocket.close();
|
||||
|
||||
// Local server does not work in WinRT build.
|
||||
#ifndef Q_OS_WINRT
|
||||
psCheckLocalSocket(_localServerName);
|
||||
|
||||
if (!_localServer.listen(_localServerName)) {
|
||||
LOG(("Failed to start listening to %1 server, error %2").arg(_localServerName).arg(int(_localServer.serverError())));
|
||||
return App::quit();
|
||||
}
|
||||
#endif // !Q_OS_WINRT
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
|
||||
if (!cNoStartUpdate() && checkReadyUpdate()) {
|
||||
|
@ -326,7 +326,11 @@ namespace Logs {
|
||||
moveOldDataFrom = initialWorkingDir;
|
||||
#endif // Q_OS_LINUX && !_DEBUG
|
||||
|
||||
#endif // Q_OS_MAC || Q_OS_LINUX
|
||||
#elif defined Q_OS_WINRT // Q_OS_MAC || Q_OS_LINUX
|
||||
} else {
|
||||
cForceWorkingDir(psAppDataPath());
|
||||
workingDirChosen = true;
|
||||
#endif // Q_OS_WINRT
|
||||
}
|
||||
|
||||
LogsData = new LogsDataFields();
|
||||
@ -341,7 +345,10 @@ namespace Logs {
|
||||
}
|
||||
|
||||
cForceWorkingDir(QDir(cWorkingDir()).absolutePath() + '/');
|
||||
// WinRT build requires the working dir to stay the same for plugin loading.
|
||||
#ifndef Q_OS_WINRT
|
||||
QDir().setCurrent(cWorkingDir());
|
||||
#endif // !Q_OS_WINRT
|
||||
QDir().mkpath(cWorkingDir() + qstr("tdata"));
|
||||
|
||||
Sandbox::WorkingDirReady();
|
||||
|
@ -31,6 +31,7 @@ namespace {
|
||||
class InputStyle : public QCommonStyle {
|
||||
public:
|
||||
InputStyle() {
|
||||
setParent(QCoreApplication::instance());
|
||||
}
|
||||
|
||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget = 0) const {
|
||||
@ -44,9 +45,29 @@ namespace {
|
||||
}
|
||||
return QCommonStyle::subElementRect(r, opt, widget);
|
||||
}
|
||||
|
||||
static InputStyle<InputClass> *instance() {
|
||||
if (!_instance) {
|
||||
if (!QGuiApplication::instance()) {
|
||||
return nullptr;
|
||||
}
|
||||
_instance = new InputStyle<InputClass>();
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
~InputStyle() {
|
||||
_instance = nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
static InputStyle<InputClass> *_instance;
|
||||
|
||||
};
|
||||
InputStyle<FlatInput> _flatInputStyle;
|
||||
InputStyle<MaskedInputField> _inputFieldStyle;
|
||||
|
||||
template <typename InputClass>
|
||||
InputStyle<InputClass> *InputStyle<InputClass>::_instance = nullptr;
|
||||
|
||||
}
|
||||
|
||||
FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString &pholder, const QString &v) : QLineEdit(v, parent)
|
||||
@ -76,7 +97,7 @@ FlatInput::FlatInput(QWidget *parent, const style::flatInput &st, const QString
|
||||
connect(this, SIGNAL(textEdited(const QString &)), this, SLOT(onTextEdited()));
|
||||
if (App::wnd()) connect(this, SIGNAL(selectionChanged()), App::wnd(), SLOT(updateGlobalMenu()));
|
||||
|
||||
setStyle(&_flatInputStyle);
|
||||
setStyle(InputStyle<FlatInput>::instance());
|
||||
QLineEdit::setTextMargins(0, 0, 0, 0);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
@ -2018,7 +2039,7 @@ MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st,
|
||||
connect(this, SIGNAL(textEdited(const QString&)), this, SLOT(onTextEdited()));
|
||||
if (App::wnd()) connect(this, SIGNAL(selectionChanged()), App::wnd(), SLOT(updateGlobalMenu()));
|
||||
|
||||
setStyle(&_inputFieldStyle);
|
||||
setStyle(InputStyle<MaskedInputField>::instance());
|
||||
QLineEdit::setTextMargins(0, 0, 0, 0);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
|
@ -1470,7 +1470,6 @@ public:
|
||||
}
|
||||
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,
|
||||
@ -1479,7 +1478,6 @@ public:
|
||||
gf.width = itemWidth;
|
||||
gf.justified = false;
|
||||
gf.initWithScriptItem(si);
|
||||
#endif // !TDESKTOP_WINRT
|
||||
if (_localFrom + itemStart < _selection.to && _localFrom + itemEnd > _selection.from) {
|
||||
QFixed selX = x, selWidth = itemWidth;
|
||||
if (_localFrom + itemEnd > _selection.to || _localFrom + itemStart < _selection.from) {
|
||||
@ -1520,9 +1518,7 @@ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user