Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I8303ca41d0ca9ce1fdb27259db4f9f8448c74bcb
This commit is contained in:
commit
441ac7084c
@ -106,8 +106,7 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa
|
|||||||
QLatin1String("\\\\") + parts.at(2), &uncShares)) {
|
QLatin1String("\\\\") + parts.at(2), &uncShares)) {
|
||||||
if (uncShares.isEmpty())
|
if (uncShares.isEmpty())
|
||||||
return false; // No shares found in the server
|
return false; // No shares found in the server
|
||||||
else
|
uncFallback = true;
|
||||||
uncFallback = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -667,7 +667,8 @@ void QWindowsFileSystemWatcherEngineThread::run()
|
|||||||
if (m != '@')
|
if (m != '@')
|
||||||
DEBUG() << "QWindowsFileSystemWatcherEngine: unknown message sent to thread: " << char(m);
|
DEBUG() << "QWindowsFileSystemWatcherEngine: unknown message sent to thread: " << char(m);
|
||||||
break;
|
break;
|
||||||
} else if (r > WAIT_OBJECT_0 && r < WAIT_OBJECT_0 + uint(handlesCopy.count())) {
|
}
|
||||||
|
if (r > WAIT_OBJECT_0 && r < WAIT_OBJECT_0 + uint(handlesCopy.count())) {
|
||||||
int at = r - WAIT_OBJECT_0;
|
int at = r - WAIT_OBJECT_0;
|
||||||
Q_ASSERT(at < handlesCopy.count());
|
Q_ASSERT(at < handlesCopy.count());
|
||||||
HANDLE handle = handlesCopy.at(at);
|
HANDLE handle = handlesCopy.at(at);
|
||||||
|
@ -766,10 +766,9 @@ QString QFSFileEngine::fileName(FileName file) const
|
|||||||
int slash = ret.lastIndexOf(QLatin1Char('/'));
|
int slash = ret.lastIndexOf(QLatin1Char('/'));
|
||||||
if (slash < 0)
|
if (slash < 0)
|
||||||
return ret;
|
return ret;
|
||||||
else if (ret.at(0) != QLatin1Char('/') && slash == 2)
|
if (ret.at(0) != QLatin1Char('/') && slash == 2)
|
||||||
return ret.left(3); // include the slash
|
return ret.left(3); // include the slash
|
||||||
else
|
return ret.left(slash > 0 ? slash : 1);
|
||||||
return ret.left(slash > 0 ? slash : 1);
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
} else if (file == CanonicalName || file == CanonicalPathName) {
|
} else if (file == CanonicalName || file == CanonicalPathName) {
|
||||||
|
@ -202,7 +202,8 @@ bool QProcessPrivate::openChannel(Channel &channel)
|
|||||||
&stderrChannel.pipe[1], 0, TRUE, DUPLICATE_SAME_ACCESS);
|
&stderrChannel.pipe[1], 0, TRUE, DUPLICATE_SAME_ACCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (channel.type == Channel::Normal) {
|
switch (channel.type) {
|
||||||
|
case Channel::Normal:
|
||||||
// we're piping this channel to our own process
|
// we're piping this channel to our own process
|
||||||
if (&channel == &stdinChannel) {
|
if (&channel == &stdinChannel) {
|
||||||
if (inputChannelMode != QProcess::ForwardedInputChannel) {
|
if (inputChannelMode != QProcess::ForwardedInputChannel) {
|
||||||
@ -242,9 +243,8 @@ bool QProcessPrivate::openChannel(Channel &channel)
|
|||||||
channel.reader->startAsyncRead();
|
channel.reader->startAsyncRead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (channel.type == Channel::Redirect) {
|
case Channel::Redirect: {
|
||||||
// we're redirecting the channel to/from a file
|
// we're redirecting the channel to/from a file
|
||||||
SECURITY_ATTRIBUTES secAtt = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
|
SECURITY_ATTRIBUTES secAtt = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
|
||||||
|
|
||||||
@ -289,65 +289,65 @@ bool QProcessPrivate::openChannel(Channel &channel)
|
|||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
|
case Channel::PipeSource: {
|
||||||
Q_ASSERT_X(channel.process, "QProcess::start", "Internal error");
|
Q_ASSERT_X(channel.process, "QProcess::start", "Internal error");
|
||||||
|
// we are the source
|
||||||
|
Channel *source = &channel;
|
||||||
|
Channel *sink = &channel.process->stdinChannel;
|
||||||
|
|
||||||
Channel *source;
|
if (source->pipe[1] != INVALID_Q_PIPE) {
|
||||||
Channel *sink;
|
// already constructed by the sink
|
||||||
|
// make it inheritable
|
||||||
if (channel.type == Channel::PipeSource) {
|
HANDLE tmpHandle = source->pipe[1];
|
||||||
// we are the source
|
if (!DuplicateHandle(GetCurrentProcess(), tmpHandle,
|
||||||
source = &channel;
|
GetCurrentProcess(), &source->pipe[1],
|
||||||
sink = &channel.process->stdinChannel;
|
0, TRUE, DUPLICATE_SAME_ACCESS)) {
|
||||||
|
return false;
|
||||||
if (source->pipe[1] != INVALID_Q_PIPE) {
|
|
||||||
// already constructed by the sink
|
|
||||||
// make it inheritable
|
|
||||||
HANDLE tmpHandle = source->pipe[1];
|
|
||||||
if (!DuplicateHandle(GetCurrentProcess(), tmpHandle,
|
|
||||||
GetCurrentProcess(), &source->pipe[1],
|
|
||||||
0, TRUE, DUPLICATE_SAME_ACCESS))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CloseHandle(tmpHandle);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_ASSERT(source == &stdoutChannel);
|
CloseHandle(tmpHandle);
|
||||||
Q_ASSERT(sink->process == this && sink->type == Channel::PipeSink);
|
|
||||||
|
|
||||||
qt_create_pipe(source->pipe, /* in = */ false); // source is stdout
|
|
||||||
sink->pipe[0] = source->pipe[0];
|
|
||||||
source->pipe[0] = INVALID_Q_PIPE;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
// we are the sink;
|
|
||||||
source = &channel.process->stdoutChannel;
|
|
||||||
sink = &channel;
|
|
||||||
|
|
||||||
if (sink->pipe[0] != INVALID_Q_PIPE) {
|
|
||||||
// already constructed by the source
|
|
||||||
// make it inheritable
|
|
||||||
HANDLE tmpHandle = sink->pipe[0];
|
|
||||||
if (!DuplicateHandle(GetCurrentProcess(), tmpHandle,
|
|
||||||
GetCurrentProcess(), &sink->pipe[0],
|
|
||||||
0, TRUE, DUPLICATE_SAME_ACCESS))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
CloseHandle(tmpHandle);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
Q_ASSERT(sink == &stdinChannel);
|
|
||||||
Q_ASSERT(source->process == this && source->type == Channel::PipeSource);
|
|
||||||
|
|
||||||
qt_create_pipe(sink->pipe, /* in = */ true); // sink is stdin
|
|
||||||
source->pipe[1] = sink->pipe[1];
|
|
||||||
sink->pipe[1] = INVALID_Q_PIPE;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_ASSERT(source == &stdoutChannel);
|
||||||
|
Q_ASSERT(sink->process == this && sink->type == Channel::PipeSink);
|
||||||
|
|
||||||
|
qt_create_pipe(source->pipe, /* in = */ false); // source is stdout
|
||||||
|
sink->pipe[0] = source->pipe[0];
|
||||||
|
source->pipe[0] = INVALID_Q_PIPE;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
case Channel::PipeSink: { // we are the sink;
|
||||||
|
Q_ASSERT_X(channel.process, "QProcess::start", "Internal error");
|
||||||
|
Channel *source = &channel.process->stdoutChannel;
|
||||||
|
Channel *sink = &channel;
|
||||||
|
|
||||||
|
if (sink->pipe[0] != INVALID_Q_PIPE) {
|
||||||
|
// already constructed by the source
|
||||||
|
// make it inheritable
|
||||||
|
HANDLE tmpHandle = sink->pipe[0];
|
||||||
|
if (!DuplicateHandle(GetCurrentProcess(), tmpHandle,
|
||||||
|
GetCurrentProcess(), &sink->pipe[0],
|
||||||
|
0, TRUE, DUPLICATE_SAME_ACCESS)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CloseHandle(tmpHandle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Q_ASSERT(sink == &stdinChannel);
|
||||||
|
Q_ASSERT(source->process == this && source->type == Channel::PipeSource);
|
||||||
|
|
||||||
|
qt_create_pipe(sink->pipe, /* in = */ true); // sink is stdin
|
||||||
|
source->pipe[1] = sink->pipe[1];
|
||||||
|
sink->pipe[1] = INVALID_Q_PIPE;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} // switch (channel.type)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
|
void QProcessPrivate::destroyPipe(Q_PIPE pipe[2])
|
||||||
|
@ -377,11 +377,12 @@ typedef QVector<RegistryKey> RegistryKeyList;
|
|||||||
|
|
||||||
class QWinSettingsPrivate : public QSettingsPrivate
|
class QWinSettingsPrivate : public QSettingsPrivate
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(QWinSettingsPrivate)
|
||||||
public:
|
public:
|
||||||
QWinSettingsPrivate(QSettings::Scope scope, const QString &organization,
|
QWinSettingsPrivate(QSettings::Scope scope, const QString &organization,
|
||||||
const QString &application, REGSAM access = 0);
|
const QString &application, REGSAM access = 0);
|
||||||
QWinSettingsPrivate(QString rKey, REGSAM access = 0);
|
QWinSettingsPrivate(QString rKey, REGSAM access = 0);
|
||||||
~QWinSettingsPrivate();
|
~QWinSettingsPrivate() override;
|
||||||
|
|
||||||
void remove(const QString &uKey) override;
|
void remove(const QString &uKey) override;
|
||||||
void set(const QString &uKey, const QVariant &value) override;
|
void set(const QString &uKey, const QVariant &value) override;
|
||||||
@ -629,11 +630,9 @@ void QWinSettingsPrivate::remove(const QString &uKey)
|
|||||||
deleteChildGroups(handle, access);
|
deleteChildGroups(handle, access);
|
||||||
|
|
||||||
if (rKey.isEmpty()) {
|
if (rKey.isEmpty()) {
|
||||||
QStringList childKeys = childKeysOrGroups(handle, QSettingsPrivate::ChildKeys);
|
const QStringList childKeys = childKeysOrGroups(handle, QSettingsPrivate::ChildKeys);
|
||||||
|
|
||||||
for (int i = 0; i < childKeys.size(); ++i) {
|
|
||||||
QString group = childKeys.at(i);
|
|
||||||
|
|
||||||
|
for (const QString &group : childKeys) {
|
||||||
LONG res = RegDeleteValue(handle, reinterpret_cast<const wchar_t *>(group.utf16()));
|
LONG res = RegDeleteValue(handle, reinterpret_cast<const wchar_t *>(group.utf16()));
|
||||||
if (res != ERROR_SUCCESS) {
|
if (res != ERROR_SUCCESS) {
|
||||||
qWarning("QSettings: RegDeleteValue failed on subkey \"%s\": %s",
|
qWarning("QSettings: RegDeleteValue failed on subkey \"%s\": %s",
|
||||||
@ -754,8 +753,8 @@ bool QWinSettingsPrivate::get(const QString &uKey, QVariant *value) const
|
|||||||
{
|
{
|
||||||
QString rKey = escapedKey(uKey);
|
QString rKey = escapedKey(uKey);
|
||||||
|
|
||||||
for (int i = 0; i < regList.size(); ++i) {
|
for (const RegistryKey &r : regList) {
|
||||||
HKEY handle = regList.at(i).handle();
|
HKEY handle = r.handle();
|
||||||
if (handle != 0 && readKey(handle, rKey, value))
|
if (handle != 0 && readKey(handle, rKey, value))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -771,8 +770,8 @@ QStringList QWinSettingsPrivate::children(const QString &uKey, ChildSpec spec) c
|
|||||||
NameSet result;
|
NameSet result;
|
||||||
QString rKey = escapedKey(uKey);
|
QString rKey = escapedKey(uKey);
|
||||||
|
|
||||||
for (int i = 0; i < regList.size(); ++i) {
|
for (const RegistryKey &r : regList) {
|
||||||
HKEY parent_handle = regList.at(i).handle();
|
HKEY parent_handle = r.handle();
|
||||||
if (parent_handle == 0)
|
if (parent_handle == 0)
|
||||||
continue;
|
continue;
|
||||||
HKEY handle = openKey(parent_handle, KEY_READ, rKey, access);
|
HKEY handle = openKey(parent_handle, KEY_READ, rKey, access);
|
||||||
@ -836,26 +835,32 @@ bool QWinSettingsPrivate::isWritable() const
|
|||||||
QSettingsPrivate *QSettingsPrivate::create(QSettings::Format format, QSettings::Scope scope,
|
QSettingsPrivate *QSettingsPrivate::create(QSettings::Format format, QSettings::Scope scope,
|
||||||
const QString &organization, const QString &application)
|
const QString &organization, const QString &application)
|
||||||
{
|
{
|
||||||
if (format == QSettings::NativeFormat)
|
switch (format) {
|
||||||
|
case QSettings::NativeFormat:
|
||||||
return new QWinSettingsPrivate(scope, organization, application);
|
return new QWinSettingsPrivate(scope, organization, application);
|
||||||
else if (format == QSettings::Registry32Format)
|
case QSettings::Registry32Format:
|
||||||
return new QWinSettingsPrivate(scope, organization, application, KEY_WOW64_32KEY);
|
return new QWinSettingsPrivate(scope, organization, application, KEY_WOW64_32KEY);
|
||||||
else if (format == QSettings::Registry64Format)
|
case QSettings::Registry64Format:
|
||||||
return new QWinSettingsPrivate(scope, organization, application, KEY_WOW64_64KEY);
|
return new QWinSettingsPrivate(scope, organization, application, KEY_WOW64_64KEY);
|
||||||
else
|
default:
|
||||||
return new QConfFileSettingsPrivate(format, scope, organization, application);
|
break;
|
||||||
|
}
|
||||||
|
return new QConfFileSettingsPrivate(format, scope, organization, application);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::Format format)
|
QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::Format format)
|
||||||
{
|
{
|
||||||
if (format == QSettings::NativeFormat)
|
switch (format) {
|
||||||
|
case QSettings::NativeFormat:
|
||||||
return new QWinSettingsPrivate(fileName);
|
return new QWinSettingsPrivate(fileName);
|
||||||
else if (format == QSettings::Registry32Format)
|
case QSettings::Registry32Format:
|
||||||
return new QWinSettingsPrivate(fileName, KEY_WOW64_32KEY);
|
return new QWinSettingsPrivate(fileName, KEY_WOW64_32KEY);
|
||||||
else if (format == QSettings::Registry64Format)
|
case QSettings::Registry64Format:
|
||||||
return new QWinSettingsPrivate(fileName, KEY_WOW64_64KEY);
|
return new QWinSettingsPrivate(fileName, KEY_WOW64_64KEY);
|
||||||
else
|
default:
|
||||||
return new QConfFileSettingsPrivate(fileName, format);
|
break;
|
||||||
|
}
|
||||||
|
return new QConfFileSettingsPrivate(fileName, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -270,13 +270,11 @@ void QWindowsPipeReader::readFileCompleted(DWORD errorCode, DWORD numberOfBytesT
|
|||||||
DWORD QWindowsPipeReader::checkPipeState()
|
DWORD QWindowsPipeReader::checkPipeState()
|
||||||
{
|
{
|
||||||
DWORD bytes;
|
DWORD bytes;
|
||||||
if (PeekNamedPipe(handle, NULL, 0, NULL, &bytes, NULL)) {
|
if (PeekNamedPipe(handle, nullptr, 0, nullptr, &bytes, nullptr))
|
||||||
return bytes;
|
return bytes;
|
||||||
} else {
|
if (!pipeBroken) {
|
||||||
if (!pipeBroken) {
|
pipeBroken = true;
|
||||||
pipeBroken = true;
|
emit pipeClosed();
|
||||||
emit pipeClosed();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -72,10 +72,9 @@ static inline qint64 ticksToNanoseconds(qint64 ticks)
|
|||||||
qint64 seconds = ticks / counterFrequency;
|
qint64 seconds = ticks / counterFrequency;
|
||||||
qint64 nanoSeconds = (ticks - seconds * counterFrequency) * 1000000000 / counterFrequency;
|
qint64 nanoSeconds = (ticks - seconds * counterFrequency) * 1000000000 / counterFrequency;
|
||||||
return seconds * 1000000000 + nanoSeconds;
|
return seconds * 1000000000 + nanoSeconds;
|
||||||
} else {
|
|
||||||
// GetTickCount(64) return milliseconds
|
|
||||||
return ticks * 1000000;
|
|
||||||
}
|
}
|
||||||
|
// GetTickCount(64) returns milliseconds
|
||||||
|
return ticks * 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline qint64 nanosecondsToTicks(qint64 nsec)
|
static inline qint64 nanosecondsToTicks(qint64 nsec)
|
||||||
@ -83,10 +82,9 @@ static inline qint64 nanosecondsToTicks(qint64 nsec)
|
|||||||
if (counterFrequency > 0) {
|
if (counterFrequency > 0) {
|
||||||
// QueryPerformanceCounter uses an arbitrary frequency
|
// QueryPerformanceCounter uses an arbitrary frequency
|
||||||
return double(nsec) * counterFrequency / 1000000000.;
|
return double(nsec) * counterFrequency / 1000000000.;
|
||||||
} else {
|
|
||||||
// GetTickCount(64) uses milliseconds
|
|
||||||
return nsec / 1000000;
|
|
||||||
}
|
}
|
||||||
|
// GetTickCount(64) uses milliseconds
|
||||||
|
return nsec / 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
static quint64 getTickCount()
|
static quint64 getTickCount()
|
||||||
@ -116,10 +114,7 @@ QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
|
|||||||
{
|
{
|
||||||
resolveCounterFrequency();
|
resolveCounterFrequency();
|
||||||
|
|
||||||
if (counterFrequency > 0)
|
return counterFrequency > 0 ? PerformanceCounter : TickCounter;
|
||||||
return PerformanceCounter;
|
|
||||||
else
|
|
||||||
return TickCounter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
|
bool QElapsedTimer::isMonotonic() Q_DECL_NOTHROW
|
||||||
|
@ -141,9 +141,9 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
|
|||||||
if (message == WM_TIMER)
|
if (message == WM_TIMER)
|
||||||
KillTimer(hwnd, wp);
|
KillTimer(hwnd, wp);
|
||||||
return 0;
|
return 0;
|
||||||
} else if (dispatcher->filterNativeEvent(QByteArrayLiteral("windows_dispatcher_MSG"), &msg, &result)) {
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
if (dispatcher->filterNativeEvent(QByteArrayLiteral("windows_dispatcher_MSG"), &msg, &result))
|
||||||
|
return result;
|
||||||
|
|
||||||
#ifdef GWLP_USERDATA
|
#ifdef GWLP_USERDATA
|
||||||
auto q = reinterpret_cast<QEventDispatcherWin32 *>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
auto q = reinterpret_cast<QEventDispatcherWin32 *>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
|
||||||
@ -154,7 +154,8 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
|
|||||||
if (q != 0)
|
if (q != 0)
|
||||||
d = q->d_func();
|
d = q->d_func();
|
||||||
|
|
||||||
if (message == WM_QT_SOCKETNOTIFIER) {
|
switch (message) {
|
||||||
|
case WM_QT_SOCKETNOTIFIER: {
|
||||||
// socket notifier message
|
// socket notifier message
|
||||||
int type = -1;
|
int type = -1;
|
||||||
switch (WSAGETSELECTEVENT(lp)) {
|
switch (WSAGETSELECTEVENT(lp)) {
|
||||||
@ -202,7 +203,8 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (message == WM_QT_ACTIVATENOTIFIERS) {
|
}
|
||||||
|
case WM_QT_ACTIVATENOTIFIERS: {
|
||||||
Q_ASSERT(d != 0);
|
Q_ASSERT(d != 0);
|
||||||
|
|
||||||
// Postpone activation if we have unhandled socket notifier messages
|
// Postpone activation if we have unhandled socket notifier messages
|
||||||
@ -226,22 +228,25 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
|
|||||||
}
|
}
|
||||||
d->activateNotifiersPosted = false;
|
d->activateNotifiersPosted = false;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (message == WM_QT_SENDPOSTEDEVENTS
|
}
|
||||||
// we also use a Windows timer to send posted events when the message queue is full
|
case WM_TIMER:
|
||||||
|| (message == WM_TIMER
|
if (d->sendPostedEventsWindowsTimerId == 0
|
||||||
&& d->sendPostedEventsWindowsTimerId != 0
|
|| wp != uint(d->sendPostedEventsWindowsTimerId)) {
|
||||||
&& wp == (uint)d->sendPostedEventsWindowsTimerId)) {
|
Q_ASSERT(d != 0);
|
||||||
|
d->sendTimerEvent(wp);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
// we also use a Windows timer to send posted events when the message queue is full
|
||||||
|
Q_FALLTHROUGH();
|
||||||
|
case WM_QT_SENDPOSTEDEVENTS: {
|
||||||
const int localSerialNumber = d->serialNumber.load();
|
const int localSerialNumber = d->serialNumber.load();
|
||||||
if (localSerialNumber != d->lastSerialNumber) {
|
if (localSerialNumber != d->lastSerialNumber) {
|
||||||
d->lastSerialNumber = localSerialNumber;
|
d->lastSerialNumber = localSerialNumber;
|
||||||
q->sendPostedEvents();
|
q->sendPostedEvents();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} else if (message == WM_TIMER) {
|
|
||||||
Q_ASSERT(d != 0);
|
|
||||||
d->sendTimerEvent(wp);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
} // switch (message)
|
||||||
|
|
||||||
return DefWindowProc(hwnd, message, wp, lp);
|
return DefWindowProc(hwnd, message, wp, lp);
|
||||||
}
|
}
|
||||||
@ -683,7 +688,8 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
|
|||||||
if (sockfd < 0) {
|
if (sockfd < 0) {
|
||||||
qWarning("QSocketNotifier: Internal error");
|
qWarning("QSocketNotifier: Internal error");
|
||||||
return;
|
return;
|
||||||
} else if (notifier->thread() != thread() || thread() != QThread::currentThread()) {
|
}
|
||||||
|
if (notifier->thread() != thread() || thread() != QThread::currentThread()) {
|
||||||
qWarning("QSocketNotifier: socket notifiers cannot be enabled from another thread");
|
qWarning("QSocketNotifier: socket notifiers cannot be enabled from another thread");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -743,7 +749,8 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
|
|||||||
if (sockfd < 0) {
|
if (sockfd < 0) {
|
||||||
qWarning("QSocketNotifier: Internal error");
|
qWarning("QSocketNotifier: Internal error");
|
||||||
return;
|
return;
|
||||||
} else if (notifier->thread() != thread() || thread() != QThread::currentThread()) {
|
}
|
||||||
|
if (notifier->thread() != thread() || thread() != QThread::currentThread()) {
|
||||||
qWarning("QSocketNotifier: socket notifiers cannot be disabled from another thread");
|
qWarning("QSocketNotifier: socket notifiers cannot be disabled from another thread");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -789,7 +796,8 @@ void QEventDispatcherWin32::registerTimer(int timerId, int interval, Qt::TimerTy
|
|||||||
if (timerId < 1 || interval < 0 || !object) {
|
if (timerId < 1 || interval < 0 || !object) {
|
||||||
qWarning("QEventDispatcherWin32::registerTimer: invalid arguments");
|
qWarning("QEventDispatcherWin32::registerTimer: invalid arguments");
|
||||||
return;
|
return;
|
||||||
} else if (object->thread() != thread() || thread() != QThread::currentThread()) {
|
}
|
||||||
|
if (object->thread() != thread() || thread() != QThread::currentThread()) {
|
||||||
qWarning("QEventDispatcherWin32::registerTimer: timers cannot be started from another thread");
|
qWarning("QEventDispatcherWin32::registerTimer: timers cannot be started from another thread");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -886,8 +894,7 @@ QEventDispatcherWin32::registeredTimers(QObject *object) const
|
|||||||
|
|
||||||
Q_D(const QEventDispatcherWin32);
|
Q_D(const QEventDispatcherWin32);
|
||||||
QList<TimerInfo> list;
|
QList<TimerInfo> list;
|
||||||
for (int i = 0; i < d->timerVec.size(); ++i) {
|
for (const WinTimerInfo *t : qAsConst(d->timerVec)) {
|
||||||
const WinTimerInfo *t = d->timerVec.at(i);
|
|
||||||
if (t && t->obj == object)
|
if (t && t->obj == object)
|
||||||
list << TimerInfo(t->timerId, t->interval, t->timerType);
|
list << TimerInfo(t->timerId, t->interval, t->timerType);
|
||||||
}
|
}
|
||||||
@ -984,17 +991,9 @@ int QEventDispatcherWin32::remainingTime(int timerId)
|
|||||||
|
|
||||||
quint64 currentTime = qt_msectime();
|
quint64 currentTime = qt_msectime();
|
||||||
|
|
||||||
WinTimerInfo *t;
|
for (const WinTimerInfo *t : qAsConst(d->timerVec)) {
|
||||||
for (int i=0; i<d->timerVec.size(); i++) {
|
if (t && t->timerId == timerId) // timer found, return time to wait
|
||||||
t = d->timerVec.at(i);
|
return t->timeout > currentTime ? t->timeout - currentTime : 0;
|
||||||
if (t && t->timerId == timerId) { // timer found
|
|
||||||
if (currentTime < t->timeout) {
|
|
||||||
// time to wait
|
|
||||||
return t->timeout - currentTime;
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG
|
#ifndef QT_NO_DEBUG
|
||||||
@ -1054,7 +1053,8 @@ void QEventDispatcherWin32::closingDown()
|
|||||||
bool QEventDispatcherWin32::event(QEvent *e)
|
bool QEventDispatcherWin32::event(QEvent *e)
|
||||||
{
|
{
|
||||||
Q_D(QEventDispatcherWin32);
|
Q_D(QEventDispatcherWin32);
|
||||||
if (e->type() == QEvent::ZeroTimerEvent) {
|
switch (e->type()) {
|
||||||
|
case QEvent::ZeroTimerEvent: {
|
||||||
QZeroTimerEvent *zte = static_cast<QZeroTimerEvent*>(e);
|
QZeroTimerEvent *zte = static_cast<QZeroTimerEvent*>(e);
|
||||||
WinTimerInfo *t = d->timerDict.value(zte->timerId());
|
WinTimerInfo *t = d->timerDict.value(zte->timerId());
|
||||||
if (t) {
|
if (t) {
|
||||||
@ -1076,9 +1076,12 @@ bool QEventDispatcherWin32::event(QEvent *e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (e->type() == QEvent::Timer) {
|
}
|
||||||
QTimerEvent *te = static_cast<QTimerEvent*>(e);
|
case QEvent::Timer:
|
||||||
d->sendTimerEvent(te->timerId());
|
d->sendTimerEvent(static_cast<const QTimerEvent*>(e)->timerId());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return QAbstractEventDispatcher::event(e);
|
return QAbstractEventDispatcher::event(e);
|
||||||
}
|
}
|
||||||
|
@ -143,10 +143,7 @@ bool QSharedMemoryPrivate::create(int size)
|
|||||||
setErrorString(function);
|
setErrorString(function);
|
||||||
|
|
||||||
// hand is valid when it already exists unlike unix so explicitly check
|
// hand is valid when it already exists unlike unix so explicitly check
|
||||||
if (error == QSharedMemory::AlreadyExists || !hand)
|
return error != QSharedMemory::AlreadyExists && hand;
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode)
|
bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode)
|
||||||
|
@ -260,31 +260,27 @@ DWORD WINAPI qt_adopted_thread_watcher_function(LPVOID)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const int handleIndex = offset + ret - WAIT_OBJECT_0;
|
const int handleIndex = offset + ret - WAIT_OBJECT_0;
|
||||||
if (handleIndex == 0){
|
if (handleIndex == 0) // New handle to watch was added.
|
||||||
// New handle to watch was added.
|
|
||||||
continue;
|
continue;
|
||||||
} else {
|
const int qthreadIndex = handleIndex - 1;
|
||||||
// printf("(qt) - qt_adopted_thread_watcher_function... called\n");
|
|
||||||
const int qthreadIndex = handleIndex - 1;
|
|
||||||
|
|
||||||
qt_adopted_thread_watcher_mutex.lock();
|
qt_adopted_thread_watcher_mutex.lock();
|
||||||
QThreadData *data = QThreadData::get2(qt_adopted_qthreads.at(qthreadIndex));
|
QThreadData *data = QThreadData::get2(qt_adopted_qthreads.at(qthreadIndex));
|
||||||
qt_adopted_thread_watcher_mutex.unlock();
|
qt_adopted_thread_watcher_mutex.unlock();
|
||||||
if (data->isAdopted) {
|
if (data->isAdopted) {
|
||||||
QThread *thread = data->thread;
|
QThread *thread = data->thread;
|
||||||
Q_ASSERT(thread);
|
Q_ASSERT(thread);
|
||||||
QThreadPrivate *thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread));
|
auto thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread));
|
||||||
Q_UNUSED(thread_p)
|
Q_UNUSED(thread_p)
|
||||||
Q_ASSERT(!thread_p->finished);
|
Q_ASSERT(!thread_p->finished);
|
||||||
thread_p->finish(thread);
|
QThreadPrivate::finish(thread);
|
||||||
}
|
|
||||||
data->deref();
|
|
||||||
|
|
||||||
QMutexLocker lock(&qt_adopted_thread_watcher_mutex);
|
|
||||||
CloseHandle(qt_adopted_thread_handles.at(handleIndex));
|
|
||||||
qt_adopted_thread_handles.remove(handleIndex);
|
|
||||||
qt_adopted_qthreads.remove(qthreadIndex);
|
|
||||||
}
|
}
|
||||||
|
data->deref();
|
||||||
|
|
||||||
|
QMutexLocker lock(&qt_adopted_thread_watcher_mutex);
|
||||||
|
CloseHandle(qt_adopted_thread_handles.at(handleIndex));
|
||||||
|
qt_adopted_thread_handles.remove(handleIndex);
|
||||||
|
qt_adopted_qthreads.remove(qthreadIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
QThreadData *threadData = reinterpret_cast<QThreadData *>(TlsGetValue(qt_current_thread_data_tls_index));
|
QThreadData *threadData = reinterpret_cast<QThreadData *>(TlsGetValue(qt_current_thread_data_tls_index));
|
||||||
|
@ -223,8 +223,7 @@ void QWaitCondition::wakeOne()
|
|||||||
{
|
{
|
||||||
// wake up the first waiting thread in the queue
|
// wake up the first waiting thread in the queue
|
||||||
QMutexLocker locker(&d->mtx);
|
QMutexLocker locker(&d->mtx);
|
||||||
for (int i = 0; i < d->queue.size(); ++i) {
|
for (QWaitConditionEvent *current : qAsConst(d->queue)) {
|
||||||
QWaitConditionEvent *current = d->queue.at(i);
|
|
||||||
if (current->wokenUp)
|
if (current->wokenUp)
|
||||||
continue;
|
continue;
|
||||||
SetEvent(current->event);
|
SetEvent(current->event);
|
||||||
@ -237,8 +236,7 @@ void QWaitCondition::wakeAll()
|
|||||||
{
|
{
|
||||||
// wake up the all threads in the queue
|
// wake up the all threads in the queue
|
||||||
QMutexLocker locker(&d->mtx);
|
QMutexLocker locker(&d->mtx);
|
||||||
for (int i = 0; i < d->queue.size(); ++i) {
|
for (QWaitConditionEvent *current : qAsConst(d->queue)) {
|
||||||
QWaitConditionEvent *current = d->queue.at(i);
|
|
||||||
SetEvent(current->event);
|
SetEvent(current->event);
|
||||||
current->wokenUp = true;
|
current->wokenUp = true;
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ QVariant QSystemLocalePrivate::dayName(int day, QLocale::FormatType type)
|
|||||||
|
|
||||||
if (type == QLocale::LongFormat)
|
if (type == QLocale::LongFormat)
|
||||||
return getLocaleInfo(long_day_map[day]);
|
return getLocaleInfo(long_day_map[day]);
|
||||||
else if (type == QLocale::NarrowFormat)
|
if (type == QLocale::NarrowFormat)
|
||||||
return getLocaleInfo(narrow_day_map[day]);
|
return getLocaleInfo(narrow_day_map[day]);
|
||||||
return getLocaleInfo(short_day_map[day]);
|
return getLocaleInfo(short_day_map[day]);
|
||||||
}
|
}
|
||||||
@ -386,7 +386,7 @@ QVariant QSystemLocalePrivate::monthName(int month, QLocale::FormatType type)
|
|||||||
|
|
||||||
month -= 1;
|
month -= 1;
|
||||||
if (month < 0 || month > 11)
|
if (month < 0 || month > 11)
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
LCTYPE lctype = (type == QLocale::ShortFormat || type == QLocale::NarrowFormat)
|
LCTYPE lctype = (type == QLocale::ShortFormat || type == QLocale::NarrowFormat)
|
||||||
? short_month_map[month] : long_month_map[month];
|
? short_month_map[month] : long_month_map[month];
|
||||||
@ -988,7 +988,7 @@ LCID qt_inIsoNametoLCID(const char *name)
|
|||||||
// handle norwegian manually, the list above will fail
|
// handle norwegian manually, the list above will fail
|
||||||
if (!strncmp(name, "nb", 2))
|
if (!strncmp(name, "nb", 2))
|
||||||
return 0x0414;
|
return 0x0414;
|
||||||
else if (!strncmp(name, "nn", 2))
|
if (!strncmp(name, "nn", 2))
|
||||||
return 0x0814;
|
return 0x0814;
|
||||||
|
|
||||||
char n[64];
|
char n[64];
|
||||||
@ -1001,9 +1001,9 @@ LCID qt_inIsoNametoLCID(const char *name)
|
|||||||
++c;
|
++c;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < windows_to_iso_count; ++i) {
|
for (const WindowsToISOListElt &i : windows_to_iso_list) {
|
||||||
if (!strcmp(n, windows_to_iso_list[i].iso_name))
|
if (!strcmp(n, i.iso_name))
|
||||||
return windows_to_iso_list[i].windows_code;
|
return i.windows_code;
|
||||||
}
|
}
|
||||||
return LOCALE_USER_DEFAULT;
|
return LOCALE_USER_DEFAULT;
|
||||||
}
|
}
|
||||||
@ -1099,8 +1099,7 @@ static QByteArray getWinLocaleName(LPWSTR id)
|
|||||||
id = qstrtoll(result.data(), 0, 0, &ok);
|
id = qstrtoll(result.data(), 0, 0, &ok);
|
||||||
if ( !ok || id == 0 || id < INT_MIN || id > INT_MAX )
|
if ( !ok || id == 0 || id < INT_MIN || id > INT_MAX )
|
||||||
return result;
|
return result;
|
||||||
else
|
return winLangCodeToIsoName(int(id));
|
||||||
return winLangCodeToIsoName( (int)id );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,10 +688,10 @@ QString QWinTimeZonePrivate::displayName(QTimeZone::TimeType timeType,
|
|||||||
if (nameType == QTimeZone::OffsetName) {
|
if (nameType == QTimeZone::OffsetName) {
|
||||||
const QWinTransitionRule &rule =
|
const QWinTransitionRule &rule =
|
||||||
m_tranRules.at(ruleIndexForYear(m_tranRules, QDate::currentDate().year()));
|
m_tranRules.at(ruleIndexForYear(m_tranRules, QDate::currentDate().year()));
|
||||||
|
int offset = rule.standardTimeBias;
|
||||||
if (timeType == QTimeZone::DaylightTime)
|
if (timeType == QTimeZone::DaylightTime)
|
||||||
return isoOffsetFormat((rule.standardTimeBias + rule.daylightTimeBias) * -60);
|
offset += rule.daylightTimeBias;
|
||||||
else
|
return isoOffsetFormat(offset * -60);
|
||||||
return isoOffsetFormat((rule.standardTimeBias) * -60);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (timeType) {
|
switch (timeType) {
|
||||||
|
@ -256,10 +256,10 @@ static inline void clearFontUnlocked()
|
|||||||
QGuiApplicationPrivate::app_font = 0;
|
QGuiApplicationPrivate::app_font = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool checkRunningUnderFlatpak()
|
static bool checkNeedPortalSupport()
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(dbus)
|
#if QT_CONFIG(dbus)
|
||||||
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty();
|
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty() || qEnvironmentVariableIsSet("SNAP");
|
||||||
#else
|
#else
|
||||||
return false;
|
return false;
|
||||||
#endif // QT_CONFIG(dbus)
|
#endif // QT_CONFIG(dbus)
|
||||||
@ -1225,9 +1225,9 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
|
|||||||
if (!platformThemeName.isEmpty())
|
if (!platformThemeName.isEmpty())
|
||||||
themeNames.append(platformThemeName);
|
themeNames.append(platformThemeName);
|
||||||
|
|
||||||
// 2) Special case - check whether we are in sandbox to use flatpak platform theme for portals support
|
// 2) Special case - check whether it's a flatpak or snap app to use xdg-desktop-portal platform theme for portals support
|
||||||
if (checkRunningUnderFlatpak()) {
|
if (checkNeedPortalSupport()) {
|
||||||
themeNames.append(QStringLiteral("flatpak"));
|
themeNames.append(QStringLiteral("xdgdesktopportal"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3) Ask the platform integration for a list of theme names
|
// 3) Ask the platform integration for a list of theme names
|
||||||
|
@ -370,7 +370,10 @@ static QList<QNetworkProxy> parseServerList(const QNetworkProxyQuery &query, con
|
|||||||
#if !defined(Q_OS_WINRT)
|
#if !defined(Q_OS_WINRT)
|
||||||
namespace {
|
namespace {
|
||||||
class QRegistryWatcher {
|
class QRegistryWatcher {
|
||||||
|
Q_DISABLE_COPY(QRegistryWatcher)
|
||||||
public:
|
public:
|
||||||
|
QRegistryWatcher() = default;
|
||||||
|
|
||||||
void addLocation(HKEY hive, const QString& path)
|
void addLocation(HKEY hive, const QString& path)
|
||||||
{
|
{
|
||||||
HKEY openedKey;
|
HKEY openedKey;
|
||||||
@ -422,6 +425,7 @@ private:
|
|||||||
|
|
||||||
class QWindowsSystemProxy
|
class QWindowsSystemProxy
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(QWindowsSystemProxy)
|
||||||
public:
|
public:
|
||||||
QWindowsSystemProxy();
|
QWindowsSystemProxy();
|
||||||
~QWindowsSystemProxy();
|
~QWindowsSystemProxy();
|
||||||
|
@ -202,11 +202,15 @@ messageDebugEntries[] = {
|
|||||||
{WM_TOUCHHITTESTING, "WM_TOUCHHITTESTING", true},
|
{WM_TOUCHHITTESTING, "WM_TOUCHHITTESTING", true},
|
||||||
{WM_POINTERWHEEL, "WM_POINTERWHEEL", true},
|
{WM_POINTERWHEEL, "WM_POINTERWHEEL", true},
|
||||||
{WM_POINTERHWHEEL, "WM_POINTERHWHEEL", true},
|
{WM_POINTERHWHEEL, "WM_POINTERHWHEEL", true},
|
||||||
|
#endif // WM_POINTERUPDATE
|
||||||
|
#ifdef DM_POINTERHITTEST
|
||||||
{DM_POINTERHITTEST, "DM_POINTERHITTEST", true},
|
{DM_POINTERHITTEST, "DM_POINTERHITTEST", true},
|
||||||
|
#endif // DM_POINTERHITTEST
|
||||||
|
#ifdef WM_POINTERROUTEDTO
|
||||||
{WM_POINTERROUTEDTO, "WM_POINTERROUTEDTO", true},
|
{WM_POINTERROUTEDTO, "WM_POINTERROUTEDTO", true},
|
||||||
{WM_POINTERROUTEDAWAY, "WM_POINTERROUTEDAWAY", true},
|
{WM_POINTERROUTEDAWAY, "WM_POINTERROUTEDAWAY", true},
|
||||||
{WM_POINTERROUTEDRELEASED, "WM_POINTERROUTEDRELEASED", true}
|
{WM_POINTERROUTEDRELEASED, "WM_POINTERROUTEDRELEASED", true},
|
||||||
#endif // WM_POINTERUPDATE
|
#endif // WM_POINTERROUTEDTO
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline const MessageDebugEntry *messageDebugEntry(UINT msg)
|
static inline const MessageDebugEntry *messageDebugEntry(UINT msg)
|
||||||
|
@ -368,6 +368,7 @@ namespace {
|
|||||||
|
|
||||||
class DirectWriteFontFileStream: public IDWriteFontFileStream
|
class DirectWriteFontFileStream: public IDWriteFontFileStream
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(DirectWriteFontFileStream)
|
||||||
public:
|
public:
|
||||||
DirectWriteFontFileStream(const QByteArray &fontData)
|
DirectWriteFontFileStream(const QByteArray &fontData)
|
||||||
: m_fontData(fontData)
|
: m_fontData(fontData)
|
||||||
@ -1604,7 +1605,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
|
|||||||
|
|
||||||
void QWindowsFontDatabase::removeApplicationFonts()
|
void QWindowsFontDatabase::removeApplicationFonts()
|
||||||
{
|
{
|
||||||
foreach (const WinApplicationFont &font, m_applicationFonts) {
|
for (const WinApplicationFont &font : qAsConst(m_applicationFonts)) {
|
||||||
if (font.handle) {
|
if (font.handle) {
|
||||||
RemoveFontMemResourceEx(font.handle);
|
RemoveFontMemResourceEx(font.handle);
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,6 +85,7 @@ public:
|
|||||||
|
|
||||||
class QWindowsFontDatabase : public QPlatformFontDatabase
|
class QWindowsFontDatabase : public QPlatformFontDatabase
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(QWindowsFontDatabase)
|
||||||
public:
|
public:
|
||||||
enum FontOptions {
|
enum FontOptions {
|
||||||
// Relevant bits from QWindowsIntegration::Options
|
// Relevant bits from QWindowsIntegration::Options
|
||||||
@ -93,7 +94,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
QWindowsFontDatabase();
|
QWindowsFontDatabase();
|
||||||
~QWindowsFontDatabase();
|
~QWindowsFontDatabase() override;
|
||||||
|
|
||||||
void populateFontDatabase() override;
|
void populateFontDatabase() override;
|
||||||
void populateFamily(const QString &familyName) override;
|
void populateFamily(const QString &familyName) override;
|
||||||
|
@ -66,13 +66,14 @@ class QWindowsFontEngineData;
|
|||||||
|
|
||||||
class QWindowsFontEngine : public QFontEngine
|
class QWindowsFontEngine : public QFontEngine
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(QWindowsFontEngine)
|
||||||
friend class QWindowsMultiFontEngine;
|
friend class QWindowsMultiFontEngine;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QWindowsFontEngine(const QString &name, LOGFONT lf,
|
QWindowsFontEngine(const QString &name, LOGFONT lf,
|
||||||
const QSharedPointer<QWindowsFontEngineData> &fontEngineData);
|
const QSharedPointer<QWindowsFontEngineData> &fontEngineData);
|
||||||
|
|
||||||
~QWindowsFontEngine();
|
~QWindowsFontEngine() override;
|
||||||
void initFontInfo(const QFontDef &request,
|
void initFontInfo(const QFontDef &request,
|
||||||
int dpi);
|
int dpi);
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ public:
|
|||||||
void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override;
|
void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const override;
|
||||||
|
|
||||||
void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
|
void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override;
|
||||||
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
|
void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs,
|
||||||
QPainterPath *path, QTextItem::RenderFlags flags) override;
|
QPainterPath *path, QTextItem::RenderFlags flags) override;
|
||||||
|
|
||||||
HGDIOBJ selectDesignFont() const;
|
HGDIOBJ selectDesignFont() const;
|
||||||
|
@ -69,15 +69,14 @@ namespace {
|
|||||||
|
|
||||||
class GeometrySink: public IDWriteGeometrySink
|
class GeometrySink: public IDWriteGeometrySink
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(GeometrySink)
|
||||||
public:
|
public:
|
||||||
GeometrySink(QPainterPath *path)
|
GeometrySink(QPainterPath *path)
|
||||||
: m_refCount(0), m_path(path)
|
: m_refCount(0), m_path(path)
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_path != 0);
|
Q_ASSERT(m_path != 0);
|
||||||
}
|
}
|
||||||
virtual ~GeometrySink()
|
virtual ~GeometrySink() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
IFACEMETHOD_(void, AddBeziers)(const D2D1_BEZIER_SEGMENT *beziers, UINT bezierCount);
|
IFACEMETHOD_(void, AddBeziers)(const D2D1_BEZIER_SEGMENT *beziers, UINT bezierCount);
|
||||||
IFACEMETHOD_(void, AddLines)(const D2D1_POINT_2F *points, UINT pointCount);
|
IFACEMETHOD_(void, AddLines)(const D2D1_POINT_2F *points, UINT pointCount);
|
||||||
|
@ -72,11 +72,12 @@ class QWindowsFontEngineData;
|
|||||||
|
|
||||||
class QWindowsFontEngineDirectWrite : public QFontEngine
|
class QWindowsFontEngineDirectWrite : public QFontEngine
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(QWindowsFontEngineDirectWrite)
|
||||||
public:
|
public:
|
||||||
explicit QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace,
|
explicit QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace,
|
||||||
qreal pixelSize,
|
qreal pixelSize,
|
||||||
const QSharedPointer<QWindowsFontEngineData> &d);
|
const QSharedPointer<QWindowsFontEngineData> &d);
|
||||||
~QWindowsFontEngineDirectWrite();
|
~QWindowsFontEngineDirectWrite() override;
|
||||||
|
|
||||||
void initFontInfo(const QFontDef &request, int dpi);
|
void initFontInfo(const QFontDef &request, int dpi);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
#include <QtCore/QUrl>
|
#include <QtCore/QUrl>
|
||||||
|
|
||||||
#if QT_CONFIG(dbus)
|
#if QT_CONFIG(dbus)
|
||||||
// These QtCore includes are needed for flatpak support
|
// These QtCore includes are needed for xdg-desktop-portal support
|
||||||
#include <QtCore/private/qcore_unix_p.h>
|
#include <QtCore/private/qcore_unix_p.h>
|
||||||
|
|
||||||
#include <QtCore/QFileInfo>
|
#include <QtCore/QFileInfo>
|
||||||
@ -172,12 +172,12 @@ static inline bool launch(const QString &launcher, const QUrl &url)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if QT_CONFIG(dbus)
|
#if QT_CONFIG(dbus)
|
||||||
static inline bool checkRunningUnderFlatpak()
|
static inline bool checkNeedPortalSupport()
|
||||||
{
|
{
|
||||||
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty();
|
return !QStandardPaths::locate(QStandardPaths::RuntimeLocation, QLatin1String("flatpak-info")).isEmpty() || qEnvironmentVariableIsSet("SNAP");
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool flatpakOpenFile(const QUrl &url)
|
static inline bool xdgDesktopPortalOpenFile(const QUrl &url)
|
||||||
{
|
{
|
||||||
// DBus signature:
|
// DBus signature:
|
||||||
// OpenFile (IN s parent_window,
|
// OpenFile (IN s parent_window,
|
||||||
@ -212,7 +212,7 @@ static inline bool flatpakOpenFile(const QUrl &url)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool flatpakOpenUrl(const QUrl &url)
|
static inline bool xdgDesktopPortalOpenUrl(const QUrl &url)
|
||||||
{
|
{
|
||||||
// DBus signature:
|
// DBus signature:
|
||||||
// OpenURI (IN s parent_window,
|
// OpenURI (IN s parent_window,
|
||||||
@ -236,7 +236,7 @@ static inline bool flatpakOpenUrl(const QUrl &url)
|
|||||||
return !reply.isError();
|
return !reply.isError();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool flatpakSendEmail(const QUrl &url)
|
static inline bool xdgDesktopPortalSendEmail(const QUrl &url)
|
||||||
{
|
{
|
||||||
// DBus signature:
|
// DBus signature:
|
||||||
// ComposeEmail (IN s parent_window,
|
// ComposeEmail (IN s parent_window,
|
||||||
@ -294,15 +294,15 @@ bool QGenericUnixServices::openUrl(const QUrl &url)
|
|||||||
{
|
{
|
||||||
if (url.scheme() == QLatin1String("mailto")) {
|
if (url.scheme() == QLatin1String("mailto")) {
|
||||||
#if QT_CONFIG(dbus)
|
#if QT_CONFIG(dbus)
|
||||||
if (checkRunningUnderFlatpak())
|
if (checkNeedPortalSupport())
|
||||||
return flatpakSendEmail(url);
|
return xdgDesktopPortalSendEmail(url);
|
||||||
#endif
|
#endif
|
||||||
return openDocument(url);
|
return openDocument(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_CONFIG(dbus)
|
#if QT_CONFIG(dbus)
|
||||||
if (checkRunningUnderFlatpak())
|
if (checkNeedPortalSupport())
|
||||||
return flatpakOpenUrl(url);
|
return xdgDesktopPortalOpenUrl(url);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) {
|
if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) {
|
||||||
@ -315,8 +315,8 @@ bool QGenericUnixServices::openUrl(const QUrl &url)
|
|||||||
bool QGenericUnixServices::openDocument(const QUrl &url)
|
bool QGenericUnixServices::openDocument(const QUrl &url)
|
||||||
{
|
{
|
||||||
#if QT_CONFIG(dbus)
|
#if QT_CONFIG(dbus)
|
||||||
if (checkRunningUnderFlatpak())
|
if (checkNeedPortalSupport())
|
||||||
return flatpakOpenFile(url);
|
return xdgDesktopPortalOpenFile(url);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_documentLauncher.isEmpty() && !detectWebBrowser(desktopEnvironment(), false, &m_documentLauncher)) {
|
if (m_documentLauncher.isEmpty() && !detectWebBrowser(desktopEnvironment(), false, &m_documentLauncher)) {
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"Keys": [ "flatpak" ]
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
TARGET = qflatpak
|
|
||||||
|
|
||||||
PLUGIN_TYPE = platformthemes
|
|
||||||
PLUGIN_EXTENDS = -
|
|
||||||
PLUGIN_CLASS_NAME = QFlatpakThemePlugin
|
|
||||||
load(qt_plugin)
|
|
||||||
|
|
||||||
QT += core-private dbus gui-private theme_support-private
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
qflatpaktheme.h \
|
|
||||||
qflatpakfiledialog_p.h
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
main.cpp \
|
|
||||||
qflatpaktheme.cpp \
|
|
||||||
qflatpakfiledialog.cpp
|
|
@ -1,6 +1,6 @@
|
|||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
QT_FOR_CONFIG += widgets-private
|
QT_FOR_CONFIG += widgets-private
|
||||||
|
|
||||||
qtConfig(dbus):qtConfig(regularexpression): SUBDIRS += flatpak
|
qtConfig(dbus):qtConfig(regularexpression): SUBDIRS += xdgdesktopportal
|
||||||
|
|
||||||
qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk3
|
qtHaveModule(widgets):qtConfig(gtk3): SUBDIRS += gtk3
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2017 Red Hat, Inc
|
** Copyright (C) 2017-2018 Red Hat, Inc
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the plugins of the Qt Toolkit.
|
** This file is part of the plugins of the Qt Toolkit.
|
||||||
@ -38,24 +38,26 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <qpa/qplatformthemeplugin.h>
|
#include <qpa/qplatformthemeplugin.h>
|
||||||
#include "qflatpaktheme.h"
|
#include "qxdgdesktopportaltheme.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QFlatpakThemePlugin : public QPlatformThemePlugin
|
class QXdgDesktopPortalThemePlugin : public QPlatformThemePlugin
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PLUGIN_METADATA(IID QPlatformThemeFactoryInterface_iid FILE "flatpak.json")
|
Q_PLUGIN_METADATA(IID QPlatformThemeFactoryInterface_iid FILE "xdgdesktopportal.json")
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QPlatformTheme *create(const QString &key, const QStringList ¶ms) override;
|
QPlatformTheme *create(const QString &key, const QStringList ¶ms) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
QPlatformTheme *QFlatpakThemePlugin::create(const QString &key, const QStringList ¶ms)
|
QPlatformTheme *QXdgDesktopPortalThemePlugin::create(const QString &key, const QStringList ¶ms)
|
||||||
{
|
{
|
||||||
Q_UNUSED(params);
|
Q_UNUSED(params);
|
||||||
if (!key.compare(QLatin1String("flatpak"), Qt::CaseInsensitive))
|
if (!key.compare(QLatin1String("xdgdesktopportal"), Qt::CaseInsensitive) ||
|
||||||
return new QFlatpakTheme;
|
!key.compare(QLatin1String("flatpak"), Qt::CaseInsensitive) ||
|
||||||
|
!key.compare(QLatin1String("snap"), Qt::CaseInsensitive))
|
||||||
|
return new QXdgDesktopPortalTheme;
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2017 Red Hat, Inc
|
** Copyright (C) 2017-2018 Red Hat, Inc
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the plugins of the Qt Toolkit.
|
** This file is part of the plugins of the Qt Toolkit.
|
||||||
@ -37,7 +37,7 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qflatpakfiledialog_p.h"
|
#include "qxdgdesktopportalfiledialog_p.h"
|
||||||
|
|
||||||
#include <QtCore/qeventloop.h>
|
#include <QtCore/qeventloop.h>
|
||||||
|
|
||||||
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::FilterCondition &filterCondition)
|
QDBusArgument &operator <<(QDBusArgument &arg, const QXdgDesktopPortalFileDialog::FilterCondition &filterCondition)
|
||||||
{
|
{
|
||||||
arg.beginStructure();
|
arg.beginStructure();
|
||||||
arg << filterCondition.type << filterCondition.pattern;
|
arg << filterCondition.type << filterCondition.pattern;
|
||||||
@ -64,20 +64,20 @@ QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::FilterC
|
|||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QDBusArgument &operator >>(const QDBusArgument &arg, QFlatpakFileDialog::FilterCondition &filterCondition)
|
const QDBusArgument &operator >>(const QDBusArgument &arg, QXdgDesktopPortalFileDialog::FilterCondition &filterCondition)
|
||||||
{
|
{
|
||||||
uint type;
|
uint type;
|
||||||
QString filterPattern;
|
QString filterPattern;
|
||||||
arg.beginStructure();
|
arg.beginStructure();
|
||||||
arg >> type >> filterPattern;
|
arg >> type >> filterPattern;
|
||||||
filterCondition.type = (QFlatpakFileDialog::ConditionType)type;
|
filterCondition.type = (QXdgDesktopPortalFileDialog::ConditionType)type;
|
||||||
filterCondition.pattern = filterPattern;
|
filterCondition.pattern = filterPattern;
|
||||||
arg.endStructure();
|
arg.endStructure();
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::Filter filter)
|
QDBusArgument &operator <<(QDBusArgument &arg, const QXdgDesktopPortalFileDialog::Filter filter)
|
||||||
{
|
{
|
||||||
arg.beginStructure();
|
arg.beginStructure();
|
||||||
arg << filter.name << filter.filterConditions;
|
arg << filter.name << filter.filterConditions;
|
||||||
@ -85,10 +85,10 @@ QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::Filter
|
|||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QDBusArgument &operator >>(const QDBusArgument &arg, QFlatpakFileDialog::Filter &filter)
|
const QDBusArgument &operator >>(const QDBusArgument &arg, QXdgDesktopPortalFileDialog::Filter &filter)
|
||||||
{
|
{
|
||||||
QString name;
|
QString name;
|
||||||
QFlatpakFileDialog::FilterConditionList filterConditions;
|
QXdgDesktopPortalFileDialog::FilterConditionList filterConditions;
|
||||||
arg.beginStructure();
|
arg.beginStructure();
|
||||||
arg >> name >> filterConditions;
|
arg >> name >> filterConditions;
|
||||||
filter.name = name;
|
filter.name = name;
|
||||||
@ -98,10 +98,10 @@ const QDBusArgument &operator >>(const QDBusArgument &arg, QFlatpakFileDialog::F
|
|||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
class QFlatpakFileDialogPrivate
|
class QXdgDesktopPortalFileDialogPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QFlatpakFileDialogPrivate(QPlatformFileDialogHelper *nativeFileDialog)
|
QXdgDesktopPortalFileDialogPrivate(QPlatformFileDialogHelper *nativeFileDialog)
|
||||||
: nativeFileDialog(nativeFileDialog)
|
: nativeFileDialog(nativeFileDialog)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -118,11 +118,11 @@ public:
|
|||||||
QPlatformFileDialogHelper *nativeFileDialog = nullptr;
|
QPlatformFileDialogHelper *nativeFileDialog = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
QFlatpakFileDialog::QFlatpakFileDialog(QPlatformFileDialogHelper *nativeFileDialog)
|
QXdgDesktopPortalFileDialog::QXdgDesktopPortalFileDialog(QPlatformFileDialogHelper *nativeFileDialog)
|
||||||
: QPlatformFileDialogHelper()
|
: QPlatformFileDialogHelper()
|
||||||
, d_ptr(new QFlatpakFileDialogPrivate(nativeFileDialog))
|
, d_ptr(new QXdgDesktopPortalFileDialogPrivate(nativeFileDialog))
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog) {
|
if (d->nativeFileDialog) {
|
||||||
connect(d->nativeFileDialog, SIGNAL(accept()), this, SIGNAL(accept()));
|
connect(d->nativeFileDialog, SIGNAL(accept()), this, SIGNAL(accept()));
|
||||||
@ -130,13 +130,13 @@ QFlatpakFileDialog::QFlatpakFileDialog(QPlatformFileDialogHelper *nativeFileDial
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFlatpakFileDialog::~QFlatpakFileDialog()
|
QXdgDesktopPortalFileDialog::~QXdgDesktopPortalFileDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::initializeDialog()
|
void QXdgDesktopPortalFileDialog::initializeDialog()
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog)
|
if (d->nativeFileDialog)
|
||||||
d->nativeFileDialog->setOptions(options());
|
d->nativeFileDialog->setOptions(options());
|
||||||
@ -162,9 +162,9 @@ void QFlatpakFileDialog::initializeDialog()
|
|||||||
setDirectory(options()->initialDirectory());
|
setDirectory(options()->initialDirectory());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::openPortal()
|
void QXdgDesktopPortalFileDialog::openPortal()
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakFileDialog);
|
Q_D(const QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
|
QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String("org.freedesktop.portal.Desktop"),
|
||||||
QLatin1String("/org/freedesktop/portal/desktop"),
|
QLatin1String("/org/freedesktop/portal/desktop"),
|
||||||
@ -270,14 +270,14 @@ void QFlatpakFileDialog::openPortal()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QFlatpakFileDialog::defaultNameFilterDisables() const
|
bool QXdgDesktopPortalFileDialog::defaultNameFilterDisables() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::setDirectory(const QUrl &directory)
|
void QXdgDesktopPortalFileDialog::setDirectory(const QUrl &directory)
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog) {
|
if (d->nativeFileDialog) {
|
||||||
d->nativeFileDialog->setOptions(options());
|
d->nativeFileDialog->setOptions(options());
|
||||||
@ -287,9 +287,9 @@ void QFlatpakFileDialog::setDirectory(const QUrl &directory)
|
|||||||
d->directory = directory.path();
|
d->directory = directory.path();
|
||||||
}
|
}
|
||||||
|
|
||||||
QUrl QFlatpakFileDialog::directory() const
|
QUrl QXdgDesktopPortalFileDialog::directory() const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakFileDialog);
|
Q_D(const QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly))
|
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly))
|
||||||
return d->nativeFileDialog->directory();
|
return d->nativeFileDialog->directory();
|
||||||
@ -297,9 +297,9 @@ QUrl QFlatpakFileDialog::directory() const
|
|||||||
return d->directory;
|
return d->directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::selectFile(const QUrl &filename)
|
void QXdgDesktopPortalFileDialog::selectFile(const QUrl &filename)
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog) {
|
if (d->nativeFileDialog) {
|
||||||
d->nativeFileDialog->setOptions(options());
|
d->nativeFileDialog->setOptions(options());
|
||||||
@ -309,9 +309,9 @@ void QFlatpakFileDialog::selectFile(const QUrl &filename)
|
|||||||
d->selectedFiles << filename.path();
|
d->selectedFiles << filename.path();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QUrl> QFlatpakFileDialog::selectedFiles() const
|
QList<QUrl> QXdgDesktopPortalFileDialog::selectedFiles() const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakFileDialog);
|
Q_D(const QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly))
|
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly))
|
||||||
return d->nativeFileDialog->selectedFiles();
|
return d->nativeFileDialog->selectedFiles();
|
||||||
@ -323,9 +323,9 @@ QList<QUrl> QFlatpakFileDialog::selectedFiles() const
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::setFilter()
|
void QXdgDesktopPortalFileDialog::setFilter()
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog) {
|
if (d->nativeFileDialog) {
|
||||||
d->nativeFileDialog->setOptions(options());
|
d->nativeFileDialog->setOptions(options());
|
||||||
@ -333,9 +333,9 @@ void QFlatpakFileDialog::setFilter()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::selectNameFilter(const QString &filter)
|
void QXdgDesktopPortalFileDialog::selectNameFilter(const QString &filter)
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog) {
|
if (d->nativeFileDialog) {
|
||||||
d->nativeFileDialog->setOptions(options());
|
d->nativeFileDialog->setOptions(options());
|
||||||
@ -343,15 +343,15 @@ void QFlatpakFileDialog::selectNameFilter(const QString &filter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QFlatpakFileDialog::selectedNameFilter() const
|
QString QXdgDesktopPortalFileDialog::selectedNameFilter() const
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::exec()
|
void QXdgDesktopPortalFileDialog::exec()
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly)) {
|
if (d->nativeFileDialog && (options()->fileMode() == QFileDialogOptions::Directory || options()->fileMode() == QFileDialogOptions::DirectoryOnly)) {
|
||||||
d->nativeFileDialog->exec();
|
d->nativeFileDialog->exec();
|
||||||
@ -365,17 +365,17 @@ void QFlatpakFileDialog::exec()
|
|||||||
loop.exec();
|
loop.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::hide()
|
void QXdgDesktopPortalFileDialog::hide()
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (d->nativeFileDialog)
|
if (d->nativeFileDialog)
|
||||||
d->nativeFileDialog->hide();
|
d->nativeFileDialog->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QFlatpakFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
|
bool QXdgDesktopPortalFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent)
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
initializeDialog();
|
initializeDialog();
|
||||||
|
|
||||||
@ -390,9 +390,9 @@ bool QFlatpakFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakFileDialog::gotResponse(uint response, const QVariantMap &results)
|
void QXdgDesktopPortalFileDialog::gotResponse(uint response, const QVariantMap &results)
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakFileDialog);
|
Q_D(QXdgDesktopPortalFileDialog);
|
||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
if (results.contains(QLatin1String("uris")))
|
if (results.contains(QLatin1String("uris")))
|
@ -1,6 +1,6 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Copyright (C) 2017 Red Hat, Inc
|
** Copyright (C) 2017-2018 Red Hat, Inc
|
||||||
** Contact: https://www.qt.io/licensing/
|
** Contact: https://www.qt.io/licensing/
|
||||||
**
|
**
|
||||||
** This file is part of the plugins of the Qt Toolkit.
|
** This file is part of the plugins of the Qt Toolkit.
|
||||||
@ -36,20 +36,20 @@
|
|||||||
** $QT_END_LICENSE$
|
** $QT_END_LICENSE$
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef QFLATPAKFILEDIALOG_P_H
|
#ifndef QXDGDESKTOPPORTALFILEDIALOG_P_H
|
||||||
#define QFLATPAKFILEDIALOG_P_H
|
#define QXDGDESKTOPPORTALFILEDIALOG_P_H
|
||||||
|
|
||||||
#include <qpa/qplatformdialoghelper.h>
|
#include <qpa/qplatformdialoghelper.h>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QFlatpakFileDialogPrivate;
|
class QXdgDesktopPortalFileDialogPrivate;
|
||||||
|
|
||||||
class QFlatpakFileDialog : public QPlatformFileDialogHelper
|
class QXdgDesktopPortalFileDialog : public QPlatformFileDialogHelper
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DECLARE_PRIVATE(QFlatpakFileDialog)
|
Q_DECLARE_PRIVATE(QXdgDesktopPortalFileDialog)
|
||||||
public:
|
public:
|
||||||
enum ConditionType : uint {
|
enum ConditionType : uint {
|
||||||
GlobalPattern = 0,
|
GlobalPattern = 0,
|
||||||
@ -69,8 +69,8 @@ public:
|
|||||||
};
|
};
|
||||||
typedef QVector<Filter> FilterList;
|
typedef QVector<Filter> FilterList;
|
||||||
|
|
||||||
QFlatpakFileDialog(QPlatformFileDialogHelper *nativeFileDialog = nullptr);
|
QXdgDesktopPortalFileDialog(QPlatformFileDialogHelper *nativeFileDialog = nullptr);
|
||||||
~QFlatpakFileDialog();
|
~QXdgDesktopPortalFileDialog();
|
||||||
|
|
||||||
bool defaultNameFilterDisables() const override;
|
bool defaultNameFilterDisables() const override;
|
||||||
QUrl directory() const override;
|
QUrl directory() const override;
|
||||||
@ -92,15 +92,15 @@ private:
|
|||||||
void initializeDialog();
|
void initializeDialog();
|
||||||
void openPortal();
|
void openPortal();
|
||||||
|
|
||||||
QScopedPointer<QFlatpakFileDialogPrivate> d_ptr;
|
QScopedPointer<QXdgDesktopPortalFileDialogPrivate> d_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterCondition);
|
Q_DECLARE_METATYPE(QXdgDesktopPortalFileDialog::FilterCondition);
|
||||||
Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterConditionList);
|
Q_DECLARE_METATYPE(QXdgDesktopPortalFileDialog::FilterConditionList);
|
||||||
Q_DECLARE_METATYPE(QFlatpakFileDialog::Filter);
|
Q_DECLARE_METATYPE(QXdgDesktopPortalFileDialog::Filter);
|
||||||
Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterList);
|
Q_DECLARE_METATYPE(QXdgDesktopPortalFileDialog::FilterList);
|
||||||
|
|
||||||
#endif // QFLATPAKFILEDIALOG_P_H
|
#endif // QXDGDESKTOPPORTALFILEDIALOG_P_H
|
||||||
|
|
@ -37,8 +37,8 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qflatpaktheme.h"
|
#include "qxdgdesktopportaltheme.h"
|
||||||
#include "qflatpakfiledialog_p.h"
|
#include "qxdgdesktopportalfiledialog_p.h"
|
||||||
|
|
||||||
#include <private/qguiapplication_p.h>
|
#include <private/qguiapplication_p.h>
|
||||||
#include <qpa/qplatformtheme_p.h>
|
#include <qpa/qplatformtheme_p.h>
|
||||||
@ -47,14 +47,14 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QFlatpakThemePrivate : public QPlatformThemePrivate
|
class QXdgDesktopPortalThemePrivate : public QPlatformThemePrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QFlatpakThemePrivate()
|
QXdgDesktopPortalThemePrivate()
|
||||||
: QPlatformThemePrivate()
|
: QPlatformThemePrivate()
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
~QFlatpakThemePrivate()
|
~QXdgDesktopPortalThemePrivate()
|
||||||
{
|
{
|
||||||
delete baseTheme;
|
delete baseTheme;
|
||||||
}
|
}
|
||||||
@ -62,10 +62,10 @@ public:
|
|||||||
QPlatformTheme *baseTheme;
|
QPlatformTheme *baseTheme;
|
||||||
};
|
};
|
||||||
|
|
||||||
QFlatpakTheme::QFlatpakTheme()
|
QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()
|
||||||
: d_ptr(new QFlatpakThemePrivate)
|
: d_ptr(new QXdgDesktopPortalThemePrivate)
|
||||||
{
|
{
|
||||||
Q_D(QFlatpakTheme);
|
Q_D(QXdgDesktopPortalTheme);
|
||||||
|
|
||||||
QStringList themeNames;
|
QStringList themeNames;
|
||||||
themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
|
themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
|
||||||
@ -92,33 +92,33 @@ QFlatpakTheme::QFlatpakTheme()
|
|||||||
d->baseTheme = new QPlatformTheme;
|
d->baseTheme = new QPlatformTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformMenuItem* QFlatpakTheme::createPlatformMenuItem() const
|
QPlatformMenuItem* QXdgDesktopPortalTheme::createPlatformMenuItem() const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->createPlatformMenuItem();
|
return d->baseTheme->createPlatformMenuItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformMenu* QFlatpakTheme::createPlatformMenu() const
|
QPlatformMenu* QXdgDesktopPortalTheme::createPlatformMenu() const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->createPlatformMenu();
|
return d->baseTheme->createPlatformMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformMenuBar* QFlatpakTheme::createPlatformMenuBar() const
|
QPlatformMenuBar* QXdgDesktopPortalTheme::createPlatformMenuBar() const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->createPlatformMenuBar();
|
return d->baseTheme->createPlatformMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QFlatpakTheme::showPlatformMenuBar()
|
void QXdgDesktopPortalTheme::showPlatformMenuBar()
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->showPlatformMenuBar();
|
return d->baseTheme->showPlatformMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QFlatpakTheme::usePlatformNativeDialog(DialogType type) const
|
bool QXdgDesktopPortalTheme::usePlatformNativeDialog(DialogType type) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
|
|
||||||
if (type == FileDialog)
|
if (type == FileDialog)
|
||||||
return true;
|
return true;
|
||||||
@ -126,74 +126,74 @@ bool QFlatpakTheme::usePlatformNativeDialog(DialogType type) const
|
|||||||
return d->baseTheme->usePlatformNativeDialog(type);
|
return d->baseTheme->usePlatformNativeDialog(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPlatformDialogHelper* QFlatpakTheme::createPlatformDialogHelper(DialogType type) const
|
QPlatformDialogHelper* QXdgDesktopPortalTheme::createPlatformDialogHelper(DialogType type) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
|
|
||||||
if (type == FileDialog) {
|
if (type == FileDialog) {
|
||||||
if (d->baseTheme->usePlatformNativeDialog(type))
|
if (d->baseTheme->usePlatformNativeDialog(type))
|
||||||
return new QFlatpakFileDialog(static_cast<QPlatformFileDialogHelper*>(d->baseTheme->createPlatformDialogHelper(type)));
|
return new QXdgDesktopPortalFileDialog(static_cast<QPlatformFileDialogHelper*>(d->baseTheme->createPlatformDialogHelper(type)));
|
||||||
|
|
||||||
return new QFlatpakFileDialog;
|
return new QXdgDesktopPortalFileDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
return d->baseTheme->createPlatformDialogHelper(type);
|
return d->baseTheme->createPlatformDialogHelper(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_SYSTEMTRAYICON
|
#ifndef QT_NO_SYSTEMTRAYICON
|
||||||
QPlatformSystemTrayIcon* QFlatpakTheme::createPlatformSystemTrayIcon() const
|
QPlatformSystemTrayIcon* QXdgDesktopPortalTheme::createPlatformSystemTrayIcon() const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->createPlatformSystemTrayIcon();
|
return d->baseTheme->createPlatformSystemTrayIcon();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const QPalette *QFlatpakTheme::palette(Palette type) const
|
const QPalette *QXdgDesktopPortalTheme::palette(Palette type) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->palette(type);
|
return d->baseTheme->palette(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QFont* QFlatpakTheme::font(Font type) const
|
const QFont* QXdgDesktopPortalTheme::font(Font type) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->font(type);
|
return d->baseTheme->font(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant QFlatpakTheme::themeHint(ThemeHint hint) const
|
QVariant QXdgDesktopPortalTheme::themeHint(ThemeHint hint) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->themeHint(hint);
|
return d->baseTheme->themeHint(hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap QFlatpakTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
|
QPixmap QXdgDesktopPortalTheme::standardPixmap(StandardPixmap sp, const QSizeF &size) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->standardPixmap(sp, size);
|
return d->baseTheme->standardPixmap(sp, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon QFlatpakTheme::fileIcon(const QFileInfo &fileInfo,
|
QIcon QXdgDesktopPortalTheme::fileIcon(const QFileInfo &fileInfo,
|
||||||
QPlatformTheme::IconOptions iconOptions) const
|
QPlatformTheme::IconOptions iconOptions) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->fileIcon(fileInfo, iconOptions);
|
return d->baseTheme->fileIcon(fileInfo, iconOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
QIconEngine * QFlatpakTheme::createIconEngine(const QString &iconName) const
|
QIconEngine * QXdgDesktopPortalTheme::createIconEngine(const QString &iconName) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->createIconEngine(iconName);
|
return d->baseTheme->createIconEngine(iconName);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QKeySequence> QFlatpakTheme::keyBindings(QKeySequence::StandardKey key) const
|
QList<QKeySequence> QXdgDesktopPortalTheme::keyBindings(QKeySequence::StandardKey key) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->keyBindings(key);
|
return d->baseTheme->keyBindings(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QFlatpakTheme::standardButtonText(int button) const
|
QString QXdgDesktopPortalTheme::standardButtonText(int button) const
|
||||||
{
|
{
|
||||||
Q_D(const QFlatpakTheme);
|
Q_D(const QXdgDesktopPortalTheme);
|
||||||
return d->baseTheme->standardButtonText(button);
|
return d->baseTheme->standardButtonText(button);
|
||||||
}
|
}
|
||||||
|
|
@ -37,20 +37,20 @@
|
|||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef QFLATPAKTHEME_H
|
#ifndef QXDGDESKTOPPORTALTHEME_H
|
||||||
#define QFLATPAKTHEME_H
|
#define QXDGDESKTOPPORTALTHEME_H
|
||||||
|
|
||||||
#include <qpa/qplatformtheme.h>
|
#include <qpa/qplatformtheme.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class QFlatpakThemePrivate;
|
class QXdgDesktopPortalThemePrivate;
|
||||||
|
|
||||||
class QFlatpakTheme : public QPlatformTheme
|
class QXdgDesktopPortalTheme : public QPlatformTheme
|
||||||
{
|
{
|
||||||
Q_DECLARE_PRIVATE(QFlatpakTheme)
|
Q_DECLARE_PRIVATE(QXdgDesktopPortalTheme)
|
||||||
public:
|
public:
|
||||||
QFlatpakTheme();
|
QXdgDesktopPortalTheme();
|
||||||
|
|
||||||
QPlatformMenuItem *createPlatformMenuItem() const override;
|
QPlatformMenuItem *createPlatformMenuItem() const override;
|
||||||
QPlatformMenu *createPlatformMenu() const override;
|
QPlatformMenu *createPlatformMenu() const override;
|
||||||
@ -81,10 +81,10 @@ public:
|
|||||||
QString standardButtonText(int button) const override;
|
QString standardButtonText(int button) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<QFlatpakThemePrivate> d_ptr;
|
QScopedPointer<QXdgDesktopPortalThemePrivate> d_ptr;
|
||||||
Q_DISABLE_COPY(QFlatpakTheme)
|
Q_DISABLE_COPY(QXdgDesktopPortalTheme)
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QFLATPAKTHEME_H
|
#endif // QXDGDESKTOPPORTALTHEME_H
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"Keys": [ "xdgdesktopportal", "flatpak", "snap" ]
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
TARGET = qxdgdesktopportal
|
||||||
|
|
||||||
|
PLUGIN_TYPE = platformthemes
|
||||||
|
PLUGIN_EXTENDS = -
|
||||||
|
PLUGIN_CLASS_NAME = QXdgDesktopPortalThemePlugin
|
||||||
|
load(qt_plugin)
|
||||||
|
|
||||||
|
QT += core-private dbus gui-private theme_support-private
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
qxdgdesktopportaltheme.h \
|
||||||
|
qxdgdesktopportalfiledialog_p.h
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
main.cpp \
|
||||||
|
qxdgdesktopportaltheme.cpp \
|
||||||
|
qxdgdesktopportalfiledialog.cpp
|
@ -46,9 +46,10 @@ QT_BEGIN_NAMESPACE
|
|||||||
|
|
||||||
class QWindowsPrinterSupport : public QPlatformPrinterSupport
|
class QWindowsPrinterSupport : public QPlatformPrinterSupport
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(QWindowsPrinterSupport)
|
||||||
public:
|
public:
|
||||||
QWindowsPrinterSupport();
|
QWindowsPrinterSupport();
|
||||||
~QWindowsPrinterSupport();
|
~QWindowsPrinterSupport() override;
|
||||||
|
|
||||||
QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) override;
|
QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) override;
|
||||||
QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) override;
|
QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) override;
|
||||||
|
@ -179,9 +179,7 @@ QWindowsVistaStyle::QWindowsVistaStyle()
|
|||||||
/*!
|
/*!
|
||||||
Destructor.
|
Destructor.
|
||||||
*/
|
*/
|
||||||
QWindowsVistaStyle::~QWindowsVistaStyle()
|
QWindowsVistaStyle::~QWindowsVistaStyle() = default;
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//convert Qt state flags to uxtheme button states
|
//convert Qt state flags to uxtheme button states
|
||||||
static int buttonStateId(int flags, int partId)
|
static int buttonStateId(int flags, int partId)
|
||||||
|
@ -62,38 +62,41 @@ class QWindowsVistaStyle : public QWindowsXPStyle
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QWindowsVistaStyle();
|
QWindowsVistaStyle();
|
||||||
~QWindowsVistaStyle();
|
~QWindowsVistaStyle() override;
|
||||||
|
|
||||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
||||||
QPainter *painter, const QWidget *widget = 0) const;
|
QPainter *painter,
|
||||||
|
const QWidget *widget = nullptr) const override;
|
||||||
void drawControl(ControlElement element, const QStyleOption *option,
|
void drawControl(ControlElement element, const QStyleOption *option,
|
||||||
QPainter *painter, const QWidget *widget) const;
|
QPainter *painter, const QWidget *widget) const override;
|
||||||
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
|
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
|
||||||
QPainter *painter, const QWidget *widget) const;
|
QPainter *painter, const QWidget *widget) const override;
|
||||||
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
|
QSize sizeFromContents(ContentsType type, const QStyleOption *option,
|
||||||
const QSize &size, const QWidget *widget) const;
|
const QSize &size, const QWidget *widget) const override;
|
||||||
|
|
||||||
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const;
|
QRect subElementRect(SubElement element, const QStyleOption *option,
|
||||||
|
const QWidget *widget) const override;
|
||||||
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
|
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
|
||||||
SubControl sc, const QWidget *widget) const;
|
SubControl sc, const QWidget *widget) const override;
|
||||||
|
|
||||||
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
|
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option,
|
||||||
const QPoint &pos, const QWidget *widget = 0) const;
|
const QPoint &pos, const QWidget *widget = nullptr) const override;
|
||||||
|
|
||||||
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
|
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
|
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
|
int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
|
||||||
int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
|
const QWidget *widget = nullptr) const override;
|
||||||
QStyleHintReturn *returnData = 0) const;
|
int styleHint(StyleHint hint, const QStyleOption *opt = nullptr,
|
||||||
|
const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override;
|
||||||
|
|
||||||
void polish(QWidget *widget);
|
void polish(QWidget *widget) override;
|
||||||
void unpolish(QWidget *widget);
|
void unpolish(QWidget *widget) override;
|
||||||
void polish(QPalette &pal);
|
void polish(QPalette &pal) override;
|
||||||
void polish(QApplication *app);
|
void polish(QApplication *app) override;
|
||||||
void unpolish(QApplication *app);
|
void unpolish(QApplication *app) override;
|
||||||
QPalette standardPalette() const;
|
QPalette standardPalette() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(QWindowsVistaStyle)
|
Q_DISABLE_COPY(QWindowsVistaStyle)
|
||||||
|
@ -63,35 +63,37 @@ class QWindowsXPStyle : public QWindowsStyle
|
|||||||
public:
|
public:
|
||||||
QWindowsXPStyle();
|
QWindowsXPStyle();
|
||||||
QWindowsXPStyle(QWindowsXPStylePrivate &dd);
|
QWindowsXPStyle(QWindowsXPStylePrivate &dd);
|
||||||
~QWindowsXPStyle();
|
~QWindowsXPStyle() override;
|
||||||
|
|
||||||
void unpolish(QApplication*);
|
void unpolish(QApplication*) override;
|
||||||
void polish(QApplication*);
|
void polish(QApplication*) override;
|
||||||
void polish(QWidget*);
|
void polish(QWidget*) override;
|
||||||
void polish(QPalette&);
|
void polish(QPalette&) override;
|
||||||
void unpolish(QWidget*);
|
void unpolish(QWidget*) override;
|
||||||
|
|
||||||
void drawPrimitive(PrimitiveElement pe, const QStyleOption *option, QPainter *p,
|
void drawPrimitive(PrimitiveElement pe, const QStyleOption *option, QPainter *p,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
void drawControl(ControlElement element, const QStyleOption *option, QPainter *p,
|
void drawControl(ControlElement element, const QStyleOption *option, QPainter *p,
|
||||||
const QWidget *wwidget = 0) const;
|
const QWidget *wwidget = nullptr) const override;
|
||||||
QRect subElementRect(SubElement r, const QStyleOption *option, const QWidget *widget = 0) const;
|
QRect subElementRect(SubElement r, const QStyleOption *option,
|
||||||
|
const QWidget *widget = nullptr) const override;
|
||||||
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc,
|
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *option, QPainter *p,
|
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *option, QPainter *p,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
QSize sizeFromContents(ContentsType ct, const QStyleOption *option, const QSize &contentsSize,
|
QSize sizeFromContents(ContentsType ct, const QStyleOption *option, const QSize &contentsSize,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
int pixelMetric(PixelMetric pm, const QStyleOption *option = 0,
|
int pixelMetric(PixelMetric pm, const QStyleOption *option = nullptr,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
|
int styleHint(StyleHint hint, const QStyleOption *option = nullptr,
|
||||||
QStyleHintReturn *returnData = 0) const;
|
const QWidget *widget = nullptr,
|
||||||
|
QStyleHintReturn *returnData = nullptr) const override;
|
||||||
|
|
||||||
QPalette standardPalette() const;
|
QPalette standardPalette() const override;
|
||||||
QPixmap standardPixmap(StandardPixmap standardIcon, const QStyleOption *option,
|
QPixmap standardPixmap(StandardPixmap standardIcon, const QStyleOption *option,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
|
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
|
||||||
const QWidget *widget = 0) const;
|
const QWidget *widget = nullptr) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(QWindowsXPStyle)
|
Q_DISABLE_COPY(QWindowsXPStyle)
|
||||||
|
@ -71,22 +71,23 @@ class QVistaBackButton : public QAbstractButton
|
|||||||
public:
|
public:
|
||||||
QVistaBackButton(QWidget *widget);
|
QVistaBackButton(QWidget *widget);
|
||||||
|
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const override;
|
||||||
inline QSize minimumSizeHint() const
|
inline QSize minimumSizeHint() const override
|
||||||
{ return sizeHint(); }
|
{ return sizeHint(); }
|
||||||
|
|
||||||
void enterEvent(QEvent *event);
|
void enterEvent(QEvent *event) override;
|
||||||
void leaveEvent(QEvent *event);
|
void leaveEvent(QEvent *event) override;
|
||||||
void paintEvent(QPaintEvent *event);
|
void paintEvent(QPaintEvent *event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class QWizard;
|
class QWizard;
|
||||||
|
|
||||||
class QVistaHelper : public QObject
|
class QVistaHelper : public QObject
|
||||||
{
|
{
|
||||||
|
Q_DISABLE_COPY(QVistaHelper)
|
||||||
public:
|
public:
|
||||||
QVistaHelper(QWizard *wizard);
|
QVistaHelper(QWizard *wizard);
|
||||||
~QVistaHelper();
|
~QVistaHelper() override;
|
||||||
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
|
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
|
||||||
void updateCustomMargins(bool vistaMargins);
|
void updateCustomMargins(bool vistaMargins);
|
||||||
bool setDWMTitleBar(TitleBarChangeType type);
|
bool setDWMTitleBar(TitleBarChangeType type);
|
||||||
@ -133,7 +134,7 @@ private:
|
|||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent *event);
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
void mouseReleaseEvent(QMouseEvent *event);
|
void mouseReleaseEvent(QMouseEvent *event);
|
||||||
bool eventFilter(QObject *obj, QEvent *event);
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
|
||||||
static int instanceCount;
|
static int instanceCount;
|
||||||
static VistaState cachedVistaState;
|
static VistaState cachedVistaState;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user