mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-09 08:37:26 +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
|
||||
@ -82,8 +97,22 @@ index 918c989..55ef783 100644
|
||||
+#endif
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
// 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
|
||||
@ -105,7 +134,7 @@ index 9e2a23a..861f202 100644
|
||||
- while (oldPos < len && attributes[oldPos].whiteSpace)
|
||||
- oldPos++;
|
||||
}
|
||||
|
||||
|
||||
return oldPos;
|
||||
diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h
|
||||
index f74d4d4..57d449a 100644
|
||||
@ -119,8 +148,8 @@ index f74d4d4..57d449a 100644
|
||||
+ // allow access to private constructor
|
||||
+ friend class TextBlock;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
|
||||
index ca0a8b9..26ee865 100644
|
||||
--- a/src/network/socket/qnativesocketengine_win.cpp
|
||||
@ -144,9 +173,9 @@ index 728b166..12364db 100644
|
||||
--- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
|
||||
+++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp
|
||||
@@ -172,6 +172,79 @@ void QBasicFontDatabase::releaseHandle(void *handle)
|
||||
|
||||
|
||||
extern FT_Library qt_getFreetype();
|
||||
|
||||
|
||||
+// Enable Open Sans Semibold font family reading.
|
||||
+// Copied from freetype with some modifications.
|
||||
+
|
||||
@ -240,9 +269,9 @@ index a5fe888..5878a4f 100644
|
||||
--- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
|
||||
+++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp
|
||||
@@ -381,6 +381,17 @@ static void populateFromPattern(FcPattern *pattern)
|
||||
|
||||
|
||||
familyName = QString::fromUtf8((const char *)value);
|
||||
|
||||
|
||||
+ // Enable Open Sans Semibold font family reading.
|
||||
+ if (familyName == QLatin1String("Open Sans")) {
|
||||
+ FcChar8 *styl = 0;
|
||||
@ -301,7 +330,7 @@ index 0af7790..c16f154 100644
|
||||
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
|
||||
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
|
||||
@@ -259,6 +259,13 @@ static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd)
|
||||
|
||||
|
||||
fd->foundryName = QStringLiteral("CoreText");
|
||||
fd->familyName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute);
|
||||
+
|
||||
@ -11138,13 +11167,13 @@ index faea54b..7d85080 100644
|
||||
+++ b/src/plugins/platforminputcontexts/platforminputcontexts.pro
|
||||
@@ -1,7 +1,8 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
|
||||
qtHaveModule(dbus) {
|
||||
-!mac:!win32:SUBDIRS += ibus
|
||||
+# Adding fcitx input context plugin to our static build.
|
||||
+!mac:!win32:SUBDIRS += ibus fcitx
|
||||
}
|
||||
|
||||
|
||||
contains(QT_CONFIG, xcb-plugin): SUBDIRS += compose
|
||||
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
|
||||
index caa8884..b083e65 100644
|
||||
@ -11158,7 +11187,7 @@ index caa8884..b083e65 100644
|
||||
+ // Don't terminate if reflectionDelegate does not respond to that selector, just use the default.
|
||||
+ //return NSTerminateNow;
|
||||
}
|
||||
|
||||
|
||||
if ([self canQuit]) {
|
||||
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h
|
||||
index 5a199de..5622728 100644
|
||||
@ -11172,7 +11201,7 @@ index 5a199de..5622728 100644
|
||||
+ // Optimize redraw - don't clear image if it will be fully redrawn.
|
||||
+ bool m_qImageNeedsClear;
|
||||
};
|
||||
|
||||
|
||||
QT_END_NAMESPACE
|
||||
diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
|
||||
index ca92103..225d85f 100644
|
||||
@ -11180,14 +11209,14 @@ index ca92103..225d85f 100644
|
||||
+++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm
|
||||
@@ -38,7 +38,8 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
QCocoaBackingStore::QCocoaBackingStore(QWindow *window)
|
||||
- : QPlatformBackingStore(window)
|
||||
+ // Optimize redraw - don't clear image if it will be fully redrawn.
|
||||
+ : QPlatformBackingStore(window), m_qImageNeedsClear(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -59,9 +60,11 @@ QPaintDevice *QCocoaBackingStore::paintDevice()
|
||||
if (m_qImage.size() != effectiveBufferSize) {
|
||||
QImage::Format format = (window()->format().hasAlpha() || cocoaWindow->m_drawContentBorderGradient)
|
||||
@ -11202,7 +11231,7 @@ index ca92103..225d85f 100644
|
||||
}
|
||||
return &m_qImage;
|
||||
@@ -100,7 +103,8 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy)
|
||||
|
||||
|
||||
void QCocoaBackingStore::beginPaint(const QRegion ®ion)
|
||||
{
|
||||
- if (m_qImage.hasAlphaChannel()) {
|
||||
@ -11227,7 +11256,7 @@ index c2d206f..0f9b512 100644
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -466,7 +472,8 @@ QList<int> QCocoaKeyMapper::possibleKeys(const QKeyEvent *event) const
|
||||
Qt::KeyboardModifiers neededMods = ModsTbl[i];
|
||||
int key = kbItem->qtKey[i];
|
||||
@ -11261,7 +11290,7 @@ index 8152c57..a7c1ca0 100644
|
||||
+ const int padding = 0;
|
||||
const int menuHeight = [[NSStatusBar systemStatusBar] thickness];
|
||||
const int maxImageHeight = menuHeight - padding;
|
||||
|
||||
|
||||
@@ -207,8 +211,11 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon)
|
||||
// devicePixelRatio for the "best" screen on the system.
|
||||
qreal devicePixelRatio = qApp->devicePixelRatio();
|
||||
@ -11276,21 +11305,21 @@ index 8152c57..a7c1ca0 100644
|
||||
// with a height smaller or equal to maxPixmapHeight. The pixmap
|
||||
// may rectangular; assume it has a reasonable size. If there is
|
||||
@@ -224,9 +231,9 @@ void QCocoaSystemTrayIcon::updateIcon(const QIcon &icon)
|
||||
|
||||
|
||||
// Handle SVG icons, which do not return anything for availableSizes().
|
||||
if (!selectedSize.isValid())
|
||||
- selectedSize = icon.actualSize(QSize(maxPixmapHeight, maxPixmapHeight));
|
||||
+ selectedSize = icon.actualSize(QSize(maxPixmapHeight, maxPixmapHeight), mode);
|
||||
|
||||
|
||||
- QPixmap pixmap = icon.pixmap(selectedSize);
|
||||
+ QPixmap pixmap = icon.pixmap(selectedSize, mode);
|
||||
|
||||
|
||||
// Draw a low-resolution icon if there is not enough pixels for a retina
|
||||
// icon. This prevents showing a small icon on retina displays.
|
||||
@@ -374,6 +381,11 @@ QT_END_NAMESPACE
|
||||
Q_UNUSED(notification);
|
||||
down = NO;
|
||||
|
||||
|
||||
+ // Create a rich os x tray icon (pixel-perfect, theme switching).
|
||||
+ parent->iconSelected = false;
|
||||
+ parent->systray->updateIcon(parent->icon);
|
||||
@ -11298,11 +11327,11 @@ index 8152c57..a7c1ca0 100644
|
||||
+
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
|
||||
@@ -383,6 +395,10 @@ QT_END_NAMESPACE
|
||||
int clickCount = [mouseEvent clickCount];
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
|
||||
+ // Create a rich os x tray icon (pixel-perfect, theme switching).
|
||||
+ parent->iconSelected = (clickCount != 2) && parent->menu;
|
||||
+ parent->systray->updateIcon(parent->icon);
|
||||
@ -11321,7 +11350,7 @@ index 8152c57..a7c1ca0 100644
|
||||
+
|
||||
[self menuTrackingDone:nil];
|
||||
}
|
||||
|
||||
|
||||
@@ -410,6 +431,11 @@ QT_END_NAMESPACE
|
||||
-(void)rightMouseUp:(NSEvent *)mouseEvent
|
||||
{
|
||||
@ -11333,10 +11362,10 @@ index 8152c57..a7c1ca0 100644
|
||||
+
|
||||
[self menuTrackingDone:nil];
|
||||
}
|
||||
|
||||
|
||||
@@ -425,7 +451,8 @@ QT_END_NAMESPACE
|
||||
}
|
||||
|
||||
|
||||
-(void)drawRect:(NSRect)rect {
|
||||
- [[parent item] drawStatusBarBackgroundInRect:rect withHighlight:down];
|
||||
+ // Create a rich os x tray icon (pixel-perfect, theme switching).
|
||||
@ -11373,7 +11402,7 @@ index 00cb43c..4530862 100644
|
||||
@@ -141,7 +141,8 @@ static bool isMouseEvent(NSEvent *ev)
|
||||
if (!self.window.delegate)
|
||||
return; // Already detached, pending NSAppKitDefined event
|
||||
|
||||
|
||||
- if (pw && pw->frameStrutEventsEnabled() && isMouseEvent(theEvent)) {
|
||||
+ // Fix restore after minimize or close by window buttons.
|
||||
+ if (pw && pw->frameStrutEventsEnabled() && pw->m_synchedWindowState != Qt::WindowMinimized && pw->m_isExposed && isMouseEvent(theEvent)) {
|
||||
@ -11383,7 +11412,7 @@ index 00cb43c..4530862 100644
|
||||
@@ -931,6 +932,15 @@ void QCocoaWindow::setWindowFilePath(const QString &filePath)
|
||||
[m_nsWindow setRepresentedFilename: fi.exists() ? QCFString::toNSString(filePath) : @""];
|
||||
}
|
||||
|
||||
|
||||
+// Create a good os x window icon (pixel-perfect).
|
||||
+qreal _win_devicePixelRatio() {
|
||||
+ qreal result = 1.0;
|
||||
@ -11423,7 +11452,7 @@ index 0d80333..729d4d0 100644
|
||||
}
|
||||
@@ -1451,14 +1452,14 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
quint32 nativeVirtualKey = [nsevent keyCode];
|
||||
|
||||
|
||||
QChar ch = QChar::ReplacementCharacter;
|
||||
- int keyCode = Qt::Key_unknown;
|
||||
- if ([characters length] != 0) {
|
||||
@ -11441,13 +11470,13 @@ index 0d80333..729d4d0 100644
|
||||
+ ch = QChar([charactersIgnoringModifiers characterAtIndex:0]);
|
||||
+
|
||||
+ int keyCode = [self convertKeyCode:ch];
|
||||
|
||||
|
||||
// we will send a key event unless the input method sets m_sendKeyEvent to false
|
||||
m_sendKeyEvent = true;
|
||||
@@ -1524,6 +1525,23 @@ static QTabletEvent::TabletDevice wacomTabletDevice(NSEvent *theEvent)
|
||||
[self handleKeyEvent:nsevent eventType:int(QEvent::KeyRelease)];
|
||||
}
|
||||
|
||||
|
||||
+// Enable Ctrl+Tab and Ctrl+Shift+Tab / Ctrl+Backtab handle in-app.
|
||||
+- (BOOL)performKeyEquivalent:(NSEvent *)nsevent
|
||||
+{
|
||||
@ -11475,7 +11504,7 @@ index 9211fd1..283aabd 100644
|
||||
@@ -716,12 +716,20 @@ public:
|
||||
void setSelectedFiles(const QList<QUrl> &);
|
||||
QString selectedFile() const;
|
||||
|
||||
|
||||
+ // Adding select-by-url for Windows file dialog.
|
||||
+ void setSelectedRemoteContent(const QByteArray &);
|
||||
+ QByteArray selectedRemoteContent() const;
|
||||
@ -11496,7 +11525,7 @@ index 9211fd1..283aabd 100644
|
||||
@@ -775,6 +783,21 @@ inline void QWindowsFileDialogSharedData::setSelectedFiles(const QList<QUrl> &ur
|
||||
m_data->selectedFiles = urls;
|
||||
}
|
||||
|
||||
|
||||
+// Adding select-by-url for Windows file dialog.
|
||||
+inline QByteArray QWindowsFileDialogSharedData::selectedRemoteContent() const
|
||||
+{
|
||||
@ -11518,7 +11547,7 @@ index 9211fd1..283aabd 100644
|
||||
@@ -899,6 +922,9 @@ public:
|
||||
// example by appended default suffixes, etc.
|
||||
virtual QList<QUrl> dialogResult() const = 0;
|
||||
|
||||
|
||||
+ // Adding select-by-url for Windows file dialog.
|
||||
+ virtual QByteArray dialogRemoteContent() const { return QByteArray(); }
|
||||
+
|
||||
@ -11540,7 +11569,7 @@ index 9211fd1..283aabd 100644
|
||||
+ m_fileDialog->SetFileName((wchar_t*)file.utf16());;
|
||||
+ }
|
||||
}
|
||||
|
||||
|
||||
// Return the index of the selected filter, accounting for QFileDialog
|
||||
@@ -1405,7 +1438,11 @@ bool QWindowsNativeFileDialogBase::onFileOk()
|
||||
{
|
||||
@ -11553,12 +11582,12 @@ index 9211fd1..283aabd 100644
|
||||
+
|
||||
+ return true;
|
||||
}
|
||||
|
||||
|
||||
void QWindowsNativeFileDialogBase::close()
|
||||
@@ -1534,6 +1571,9 @@ public:
|
||||
QList<QUrl> selectedFiles() const Q_DECL_OVERRIDE;
|
||||
QList<QUrl> dialogResult() const Q_DECL_OVERRIDE;
|
||||
|
||||
|
||||
+ // Adding select-by-url for Windows file dialog.
|
||||
+ QByteArray dialogRemoteContent() const Q_DECL_OVERRIDE;
|
||||
+
|
||||
@ -11568,7 +11597,7 @@ index 9211fd1..283aabd 100644
|
||||
@@ -1548,6 +1588,62 @@ QList<QUrl> QWindowsNativeOpenFileDialog::dialogResult() const
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+// Adding select-by-url for Windows file dialog.
|
||||
+QByteArray QWindowsNativeOpenFileDialog::dialogRemoteContent() const
|
||||
+{
|
||||
@ -11642,7 +11671,7 @@ index 9211fd1..283aabd 100644
|
||||
@@ -1704,6 +1804,12 @@ QList<QUrl> QWindowsFileDialogHelper::selectedFiles() const
|
||||
return m_data.selectedFiles();
|
||||
}
|
||||
|
||||
|
||||
+// Adding select-by-url for Windows file dialog.
|
||||
+QByteArray QWindowsFileDialogHelper::selectedRemoteContent() const
|
||||
+{
|
||||
@ -11666,7 +11695,7 @@ index 9211fd1..283aabd 100644
|
||||
@@ -2036,6 +2146,12 @@ QList<QUrl> QWindowsXpFileDialogHelper::selectedFiles() const
|
||||
return m_data.selectedFiles();
|
||||
}
|
||||
|
||||
|
||||
+// Adding select-by-url for Windows file dialog.
|
||||
+QByteArray QWindowsXpFileDialogHelper::selectedRemoteContent() const
|
||||
+{
|
||||
@ -11749,7 +11778,7 @@ index 3f3a6e7..f1cf176 100644
|
||||
@@ -1200,6 +1200,15 @@ QList<QUrl> QFileDialogPrivate::userSelectedFiles() const
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
+// Adding select-by-url for Windows file dialog.
|
||||
+QByteArray QFileDialogPrivate::userSelectedRemoteContent() const
|
||||
+{
|
||||
@ -11765,7 +11794,7 @@ index 3f3a6e7..f1cf176 100644
|
||||
@@ -1267,6 +1276,14 @@ QStringList QFileDialog::selectedFiles() const
|
||||
return files;
|
||||
}
|
||||
|
||||
|
||||
+// Adding select-by-url for Windows file dialog.
|
||||
+QByteArray QFileDialog::selectedRemoteContent() const
|
||||
+{
|
||||
@ -11784,13 +11813,13 @@ index ffe49a2..4213206 100644
|
||||
@@ -108,6 +108,9 @@ public:
|
||||
void selectFile(const QString &filename);
|
||||
QStringList selectedFiles() const;
|
||||
|
||||
|
||||
+ // Adding select-by-url for Windows file dialog.
|
||||
+ QByteArray selectedRemoteContent() const;
|
||||
+
|
||||
void selectUrl(const QUrl &url);
|
||||
QList<QUrl> selectedUrls() const;
|
||||
|
||||
|
||||
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
|
||||
index f610e46..ca71d55 100644
|
||||
--- a/src/widgets/dialogs/qfiledialog_p.h
|
||||
@ -11820,7 +11849,7 @@ index f610e46..ca71d55 100644
|
||||
@@ -393,6 +401,14 @@ inline QList<QUrl> QFileDialogPrivate::selectedFiles_sys() const
|
||||
return QList<QUrl>();
|
||||
}
|
||||
|
||||
|
||||
+// Adding select-by-url for Windows file dialog.
|
||||
+inline QByteArray QFileDialogPrivate::selectedRemoteContent_sys() const
|
||||
+{
|
||||
@ -11859,7 +11888,7 @@ index ebb2921..8119bad 100644
|
||||
+ qpa_sys->updateMenu(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
|
||||
index 436937b..fc7a843 100644
|
||||
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
|
||||
@ -11878,7 +11907,7 @@ index 436937b..fc7a843 100644
|
||||
#endif
|
||||
@@ -1881,11 +1886,21 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event)
|
||||
}
|
||||
|
||||
|
||||
// QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
|
||||
- if (unknown && !isReadOnly()
|
||||
- && event->modifiers() != Qt::ControlModifier
|
||||
|
@ -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