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)) {
|
||||
if (uncShares.isEmpty())
|
||||
return false; // No shares found in the server
|
||||
else
|
||||
uncFallback = true;
|
||||
uncFallback = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -667,7 +667,8 @@ void QWindowsFileSystemWatcherEngineThread::run()
|
||||
if (m != '@')
|
||||
DEBUG() << "QWindowsFileSystemWatcherEngine: unknown message sent to thread: " << char(m);
|
||||
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;
|
||||
Q_ASSERT(at < handlesCopy.count());
|
||||
HANDLE handle = handlesCopy.at(at);
|
||||
|
@ -766,10 +766,9 @@ QString QFSFileEngine::fileName(FileName file) const
|
||||
int slash = ret.lastIndexOf(QLatin1Char('/'));
|
||||
if (slash < 0)
|
||||
return ret;
|
||||
else if (ret.at(0) != QLatin1Char('/') && slash == 2)
|
||||
if (ret.at(0) != QLatin1Char('/') && slash == 2)
|
||||
return ret.left(3); // include the slash
|
||||
else
|
||||
return ret.left(slash > 0 ? slash : 1);
|
||||
return ret.left(slash > 0 ? slash : 1);
|
||||
}
|
||||
return ret;
|
||||
} else if (file == CanonicalName || file == CanonicalPathName) {
|
||||
|
@ -202,7 +202,8 @@ bool QProcessPrivate::openChannel(Channel &channel)
|
||||
&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
|
||||
if (&channel == &stdinChannel) {
|
||||
if (inputChannelMode != QProcess::ForwardedInputChannel) {
|
||||
@ -242,9 +243,8 @@ bool QProcessPrivate::openChannel(Channel &channel)
|
||||
channel.reader->startAsyncRead();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else if (channel.type == Channel::Redirect) {
|
||||
case Channel::Redirect: {
|
||||
// we're redirecting the channel to/from a file
|
||||
SECURITY_ATTRIBUTES secAtt = { sizeof(SECURITY_ATTRIBUTES), NULL, TRUE };
|
||||
|
||||
@ -289,65 +289,65 @@ bool QProcessPrivate::openChannel(Channel &channel)
|
||||
}
|
||||
cleanup();
|
||||
return false;
|
||||
} else {
|
||||
}
|
||||
case Channel::PipeSource: {
|
||||
Q_ASSERT_X(channel.process, "QProcess::start", "Internal error");
|
||||
// we are the source
|
||||
Channel *source = &channel;
|
||||
Channel *sink = &channel.process->stdinChannel;
|
||||
|
||||
Channel *source;
|
||||
Channel *sink;
|
||||
|
||||
if (channel.type == Channel::PipeSource) {
|
||||
// we are the source
|
||||
source = &channel;
|
||||
sink = &channel.process->stdinChannel;
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
} 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;
|
||||
|
||||
CloseHandle(tmpHandle);
|
||||
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])
|
||||
|
@ -377,11 +377,12 @@ typedef QVector<RegistryKey> RegistryKeyList;
|
||||
|
||||
class QWinSettingsPrivate : public QSettingsPrivate
|
||||
{
|
||||
Q_DISABLE_COPY(QWinSettingsPrivate)
|
||||
public:
|
||||
QWinSettingsPrivate(QSettings::Scope scope, const QString &organization,
|
||||
const QString &application, REGSAM access = 0);
|
||||
QWinSettingsPrivate(QString rKey, REGSAM access = 0);
|
||||
~QWinSettingsPrivate();
|
||||
~QWinSettingsPrivate() override;
|
||||
|
||||
void remove(const QString &uKey) override;
|
||||
void set(const QString &uKey, const QVariant &value) override;
|
||||
@ -629,11 +630,9 @@ void QWinSettingsPrivate::remove(const QString &uKey)
|
||||
deleteChildGroups(handle, access);
|
||||
|
||||
if (rKey.isEmpty()) {
|
||||
QStringList childKeys = childKeysOrGroups(handle, QSettingsPrivate::ChildKeys);
|
||||
|
||||
for (int i = 0; i < childKeys.size(); ++i) {
|
||||
QString group = childKeys.at(i);
|
||||
const QStringList childKeys = childKeysOrGroups(handle, QSettingsPrivate::ChildKeys);
|
||||
|
||||
for (const QString &group : childKeys) {
|
||||
LONG res = RegDeleteValue(handle, reinterpret_cast<const wchar_t *>(group.utf16()));
|
||||
if (res != ERROR_SUCCESS) {
|
||||
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);
|
||||
|
||||
for (int i = 0; i < regList.size(); ++i) {
|
||||
HKEY handle = regList.at(i).handle();
|
||||
for (const RegistryKey &r : regList) {
|
||||
HKEY handle = r.handle();
|
||||
if (handle != 0 && readKey(handle, rKey, value))
|
||||
return true;
|
||||
|
||||
@ -771,8 +770,8 @@ QStringList QWinSettingsPrivate::children(const QString &uKey, ChildSpec spec) c
|
||||
NameSet result;
|
||||
QString rKey = escapedKey(uKey);
|
||||
|
||||
for (int i = 0; i < regList.size(); ++i) {
|
||||
HKEY parent_handle = regList.at(i).handle();
|
||||
for (const RegistryKey &r : regList) {
|
||||
HKEY parent_handle = r.handle();
|
||||
if (parent_handle == 0)
|
||||
continue;
|
||||
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,
|
||||
const QString &organization, const QString &application)
|
||||
{
|
||||
if (format == QSettings::NativeFormat)
|
||||
switch (format) {
|
||||
case QSettings::NativeFormat:
|
||||
return new QWinSettingsPrivate(scope, organization, application);
|
||||
else if (format == QSettings::Registry32Format)
|
||||
case QSettings::Registry32Format:
|
||||
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);
|
||||
else
|
||||
return new QConfFileSettingsPrivate(format, scope, organization, application);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new QConfFileSettingsPrivate(format, scope, organization, application);
|
||||
}
|
||||
|
||||
QSettingsPrivate *QSettingsPrivate::create(const QString &fileName, QSettings::Format format)
|
||||
{
|
||||
if (format == QSettings::NativeFormat)
|
||||
switch (format) {
|
||||
case QSettings::NativeFormat:
|
||||
return new QWinSettingsPrivate(fileName);
|
||||
else if (format == QSettings::Registry32Format)
|
||||
case QSettings::Registry32Format:
|
||||
return new QWinSettingsPrivate(fileName, KEY_WOW64_32KEY);
|
||||
else if (format == QSettings::Registry64Format)
|
||||
case QSettings::Registry64Format:
|
||||
return new QWinSettingsPrivate(fileName, KEY_WOW64_64KEY);
|
||||
else
|
||||
return new QConfFileSettingsPrivate(fileName, format);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return new QConfFileSettingsPrivate(fileName, format);
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -270,13 +270,11 @@ void QWindowsPipeReader::readFileCompleted(DWORD errorCode, DWORD numberOfBytesT
|
||||
DWORD QWindowsPipeReader::checkPipeState()
|
||||
{
|
||||
DWORD bytes;
|
||||
if (PeekNamedPipe(handle, NULL, 0, NULL, &bytes, NULL)) {
|
||||
if (PeekNamedPipe(handle, nullptr, 0, nullptr, &bytes, nullptr))
|
||||
return bytes;
|
||||
} else {
|
||||
if (!pipeBroken) {
|
||||
pipeBroken = true;
|
||||
emit pipeClosed();
|
||||
}
|
||||
if (!pipeBroken) {
|
||||
pipeBroken = true;
|
||||
emit pipeClosed();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -72,10 +72,9 @@ static inline qint64 ticksToNanoseconds(qint64 ticks)
|
||||
qint64 seconds = ticks / counterFrequency;
|
||||
qint64 nanoSeconds = (ticks - seconds * counterFrequency) * 1000000000 / counterFrequency;
|
||||
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)
|
||||
@ -83,10 +82,9 @@ static inline qint64 nanosecondsToTicks(qint64 nsec)
|
||||
if (counterFrequency > 0) {
|
||||
// QueryPerformanceCounter uses an arbitrary frequency
|
||||
return double(nsec) * counterFrequency / 1000000000.;
|
||||
} else {
|
||||
// GetTickCount(64) uses milliseconds
|
||||
return nsec / 1000000;
|
||||
}
|
||||
// GetTickCount(64) uses milliseconds
|
||||
return nsec / 1000000;
|
||||
}
|
||||
|
||||
static quint64 getTickCount()
|
||||
@ -116,10 +114,7 @@ QElapsedTimer::ClockType QElapsedTimer::clockType() Q_DECL_NOTHROW
|
||||
{
|
||||
resolveCounterFrequency();
|
||||
|
||||
if (counterFrequency > 0)
|
||||
return PerformanceCounter;
|
||||
else
|
||||
return TickCounter;
|
||||
return counterFrequency > 0 ? PerformanceCounter : TickCounter;
|
||||
}
|
||||
|
||||
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)
|
||||
KillTimer(hwnd, wp);
|
||||
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
|
||||
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)
|
||||
d = q->d_func();
|
||||
|
||||
if (message == WM_QT_SOCKETNOTIFIER) {
|
||||
switch (message) {
|
||||
case WM_QT_SOCKETNOTIFIER: {
|
||||
// socket notifier message
|
||||
int type = -1;
|
||||
switch (WSAGETSELECTEVENT(lp)) {
|
||||
@ -202,7 +203,8 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
} else if (message == WM_QT_ACTIVATENOTIFIERS) {
|
||||
}
|
||||
case WM_QT_ACTIVATENOTIFIERS: {
|
||||
Q_ASSERT(d != 0);
|
||||
|
||||
// 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;
|
||||
return 0;
|
||||
} else if (message == WM_QT_SENDPOSTEDEVENTS
|
||||
// we also use a Windows timer to send posted events when the message queue is full
|
||||
|| (message == WM_TIMER
|
||||
&& d->sendPostedEventsWindowsTimerId != 0
|
||||
&& wp == (uint)d->sendPostedEventsWindowsTimerId)) {
|
||||
}
|
||||
case WM_TIMER:
|
||||
if (d->sendPostedEventsWindowsTimerId == 0
|
||||
|| 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();
|
||||
if (localSerialNumber != d->lastSerialNumber) {
|
||||
d->lastSerialNumber = localSerialNumber;
|
||||
q->sendPostedEvents();
|
||||
}
|
||||
return 0;
|
||||
} else if (message == WM_TIMER) {
|
||||
Q_ASSERT(d != 0);
|
||||
d->sendTimerEvent(wp);
|
||||
return 0;
|
||||
}
|
||||
} // switch (message)
|
||||
|
||||
return DefWindowProc(hwnd, message, wp, lp);
|
||||
}
|
||||
@ -683,7 +688,8 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier)
|
||||
if (sockfd < 0) {
|
||||
qWarning("QSocketNotifier: Internal error");
|
||||
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");
|
||||
return;
|
||||
}
|
||||
@ -743,7 +749,8 @@ void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier)
|
||||
if (sockfd < 0) {
|
||||
qWarning("QSocketNotifier: Internal error");
|
||||
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");
|
||||
return;
|
||||
}
|
||||
@ -789,7 +796,8 @@ void QEventDispatcherWin32::registerTimer(int timerId, int interval, Qt::TimerTy
|
||||
if (timerId < 1 || interval < 0 || !object) {
|
||||
qWarning("QEventDispatcherWin32::registerTimer: invalid arguments");
|
||||
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");
|
||||
return;
|
||||
}
|
||||
@ -886,8 +894,7 @@ QEventDispatcherWin32::registeredTimers(QObject *object) const
|
||||
|
||||
Q_D(const QEventDispatcherWin32);
|
||||
QList<TimerInfo> list;
|
||||
for (int i = 0; i < d->timerVec.size(); ++i) {
|
||||
const WinTimerInfo *t = d->timerVec.at(i);
|
||||
for (const WinTimerInfo *t : qAsConst(d->timerVec)) {
|
||||
if (t && t->obj == object)
|
||||
list << TimerInfo(t->timerId, t->interval, t->timerType);
|
||||
}
|
||||
@ -984,17 +991,9 @@ int QEventDispatcherWin32::remainingTime(int timerId)
|
||||
|
||||
quint64 currentTime = qt_msectime();
|
||||
|
||||
WinTimerInfo *t;
|
||||
for (int i=0; i<d->timerVec.size(); i++) {
|
||||
t = d->timerVec.at(i);
|
||||
if (t && t->timerId == timerId) { // timer found
|
||||
if (currentTime < t->timeout) {
|
||||
// time to wait
|
||||
return t->timeout - currentTime;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
for (const WinTimerInfo *t : qAsConst(d->timerVec)) {
|
||||
if (t && t->timerId == timerId) // timer found, return time to wait
|
||||
return t->timeout > currentTime ? t->timeout - currentTime : 0;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG
|
||||
@ -1054,7 +1053,8 @@ void QEventDispatcherWin32::closingDown()
|
||||
bool QEventDispatcherWin32::event(QEvent *e)
|
||||
{
|
||||
Q_D(QEventDispatcherWin32);
|
||||
if (e->type() == QEvent::ZeroTimerEvent) {
|
||||
switch (e->type()) {
|
||||
case QEvent::ZeroTimerEvent: {
|
||||
QZeroTimerEvent *zte = static_cast<QZeroTimerEvent*>(e);
|
||||
WinTimerInfo *t = d->timerDict.value(zte->timerId());
|
||||
if (t) {
|
||||
@ -1076,9 +1076,12 @@ bool QEventDispatcherWin32::event(QEvent *e)
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (e->type() == QEvent::Timer) {
|
||||
QTimerEvent *te = static_cast<QTimerEvent*>(e);
|
||||
d->sendTimerEvent(te->timerId());
|
||||
}
|
||||
case QEvent::Timer:
|
||||
d->sendTimerEvent(static_cast<const QTimerEvent*>(e)->timerId());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QAbstractEventDispatcher::event(e);
|
||||
}
|
||||
|
@ -143,10 +143,7 @@ bool QSharedMemoryPrivate::create(int size)
|
||||
setErrorString(function);
|
||||
|
||||
// hand is valid when it already exists unlike unix so explicitly check
|
||||
if (error == QSharedMemory::AlreadyExists || !hand)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return error != QSharedMemory::AlreadyExists && hand;
|
||||
}
|
||||
|
||||
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;
|
||||
if (handleIndex == 0){
|
||||
// New handle to watch was added.
|
||||
if (handleIndex == 0) // New handle to watch was added.
|
||||
continue;
|
||||
} else {
|
||||
// printf("(qt) - qt_adopted_thread_watcher_function... called\n");
|
||||
const int qthreadIndex = handleIndex - 1;
|
||||
const int qthreadIndex = handleIndex - 1;
|
||||
|
||||
qt_adopted_thread_watcher_mutex.lock();
|
||||
QThreadData *data = QThreadData::get2(qt_adopted_qthreads.at(qthreadIndex));
|
||||
qt_adopted_thread_watcher_mutex.unlock();
|
||||
if (data->isAdopted) {
|
||||
QThread *thread = data->thread;
|
||||
Q_ASSERT(thread);
|
||||
QThreadPrivate *thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread));
|
||||
Q_UNUSED(thread_p)
|
||||
Q_ASSERT(!thread_p->finished);
|
||||
thread_p->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);
|
||||
qt_adopted_thread_watcher_mutex.lock();
|
||||
QThreadData *data = QThreadData::get2(qt_adopted_qthreads.at(qthreadIndex));
|
||||
qt_adopted_thread_watcher_mutex.unlock();
|
||||
if (data->isAdopted) {
|
||||
QThread *thread = data->thread;
|
||||
Q_ASSERT(thread);
|
||||
auto thread_p = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread));
|
||||
Q_UNUSED(thread_p)
|
||||
Q_ASSERT(!thread_p->finished);
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
QMutexLocker locker(&d->mtx);
|
||||
for (int i = 0; i < d->queue.size(); ++i) {
|
||||
QWaitConditionEvent *current = d->queue.at(i);
|
||||
for (QWaitConditionEvent *current : qAsConst(d->queue)) {
|
||||
if (current->wokenUp)
|
||||
continue;
|
||||
SetEvent(current->event);
|
||||
@ -237,8 +236,7 @@ void QWaitCondition::wakeAll()
|
||||
{
|
||||
// wake up the all threads in the queue
|
||||
QMutexLocker locker(&d->mtx);
|
||||
for (int i = 0; i < d->queue.size(); ++i) {
|
||||
QWaitConditionEvent *current = d->queue.at(i);
|
||||
for (QWaitConditionEvent *current : qAsConst(d->queue)) {
|
||||
SetEvent(current->event);
|
||||
current->wokenUp = true;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ QVariant QSystemLocalePrivate::dayName(int day, QLocale::FormatType type)
|
||||
|
||||
if (type == QLocale::LongFormat)
|
||||
return getLocaleInfo(long_day_map[day]);
|
||||
else if (type == QLocale::NarrowFormat)
|
||||
if (type == QLocale::NarrowFormat)
|
||||
return getLocaleInfo(narrow_day_map[day]);
|
||||
return getLocaleInfo(short_day_map[day]);
|
||||
}
|
||||
@ -386,7 +386,7 @@ QVariant QSystemLocalePrivate::monthName(int month, QLocale::FormatType type)
|
||||
|
||||
month -= 1;
|
||||
if (month < 0 || month > 11)
|
||||
return QString();
|
||||
return QString();
|
||||
|
||||
LCTYPE lctype = (type == QLocale::ShortFormat || type == QLocale::NarrowFormat)
|
||||
? 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
|
||||
if (!strncmp(name, "nb", 2))
|
||||
return 0x0414;
|
||||
else if (!strncmp(name, "nn", 2))
|
||||
if (!strncmp(name, "nn", 2))
|
||||
return 0x0814;
|
||||
|
||||
char n[64];
|
||||
@ -1001,9 +1001,9 @@ LCID qt_inIsoNametoLCID(const char *name)
|
||||
++c;
|
||||
}
|
||||
|
||||
for (int i = 0; i < windows_to_iso_count; ++i) {
|
||||
if (!strcmp(n, windows_to_iso_list[i].iso_name))
|
||||
return windows_to_iso_list[i].windows_code;
|
||||
for (const WindowsToISOListElt &i : windows_to_iso_list) {
|
||||
if (!strcmp(n, i.iso_name))
|
||||
return i.windows_code;
|
||||
}
|
||||
return LOCALE_USER_DEFAULT;
|
||||
}
|
||||
@ -1099,8 +1099,7 @@ static QByteArray getWinLocaleName(LPWSTR id)
|
||||
id = qstrtoll(result.data(), 0, 0, &ok);
|
||||
if ( !ok || id == 0 || id < INT_MIN || id > INT_MAX )
|
||||
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) {
|
||||
const QWinTransitionRule &rule =
|
||||
m_tranRules.at(ruleIndexForYear(m_tranRules, QDate::currentDate().year()));
|
||||
int offset = rule.standardTimeBias;
|
||||
if (timeType == QTimeZone::DaylightTime)
|
||||
return isoOffsetFormat((rule.standardTimeBias + rule.daylightTimeBias) * -60);
|
||||
else
|
||||
return isoOffsetFormat((rule.standardTimeBias) * -60);
|
||||
offset += rule.daylightTimeBias;
|
||||
return isoOffsetFormat(offset * -60);
|
||||
}
|
||||
|
||||
switch (timeType) {
|
||||
|
@ -256,10 +256,10 @@ static inline void clearFontUnlocked()
|
||||
QGuiApplicationPrivate::app_font = 0;
|
||||
}
|
||||
|
||||
static bool checkRunningUnderFlatpak()
|
||||
static bool checkNeedPortalSupport()
|
||||
{
|
||||
#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
|
||||
return false;
|
||||
#endif // QT_CONFIG(dbus)
|
||||
@ -1225,9 +1225,9 @@ static void init_platform(const QString &pluginNamesWithArguments, const QString
|
||||
if (!platformThemeName.isEmpty())
|
||||
themeNames.append(platformThemeName);
|
||||
|
||||
// 2) Special case - check whether we are in sandbox to use flatpak platform theme for portals support
|
||||
if (checkRunningUnderFlatpak()) {
|
||||
themeNames.append(QStringLiteral("flatpak"));
|
||||
// 2) Special case - check whether it's a flatpak or snap app to use xdg-desktop-portal platform theme for portals support
|
||||
if (checkNeedPortalSupport()) {
|
||||
themeNames.append(QStringLiteral("xdgdesktopportal"));
|
||||
}
|
||||
|
||||
// 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)
|
||||
namespace {
|
||||
class QRegistryWatcher {
|
||||
Q_DISABLE_COPY(QRegistryWatcher)
|
||||
public:
|
||||
QRegistryWatcher() = default;
|
||||
|
||||
void addLocation(HKEY hive, const QString& path)
|
||||
{
|
||||
HKEY openedKey;
|
||||
@ -422,6 +425,7 @@ private:
|
||||
|
||||
class QWindowsSystemProxy
|
||||
{
|
||||
Q_DISABLE_COPY(QWindowsSystemProxy)
|
||||
public:
|
||||
QWindowsSystemProxy();
|
||||
~QWindowsSystemProxy();
|
||||
|
@ -202,11 +202,15 @@ messageDebugEntries[] = {
|
||||
{WM_TOUCHHITTESTING, "WM_TOUCHHITTESTING", true},
|
||||
{WM_POINTERWHEEL, "WM_POINTERWHEEL", true},
|
||||
{WM_POINTERHWHEEL, "WM_POINTERHWHEEL", true},
|
||||
#endif // WM_POINTERUPDATE
|
||||
#ifdef DM_POINTERHITTEST
|
||||
{DM_POINTERHITTEST, "DM_POINTERHITTEST", true},
|
||||
#endif // DM_POINTERHITTEST
|
||||
#ifdef WM_POINTERROUTEDTO
|
||||
{WM_POINTERROUTEDTO, "WM_POINTERROUTEDTO", true},
|
||||
{WM_POINTERROUTEDAWAY, "WM_POINTERROUTEDAWAY", true},
|
||||
{WM_POINTERROUTEDRELEASED, "WM_POINTERROUTEDRELEASED", true}
|
||||
#endif // WM_POINTERUPDATE
|
||||
{WM_POINTERROUTEDRELEASED, "WM_POINTERROUTEDRELEASED", true},
|
||||
#endif // WM_POINTERROUTEDTO
|
||||
};
|
||||
|
||||
static inline const MessageDebugEntry *messageDebugEntry(UINT msg)
|
||||
|
@ -368,6 +368,7 @@ namespace {
|
||||
|
||||
class DirectWriteFontFileStream: public IDWriteFontFileStream
|
||||
{
|
||||
Q_DISABLE_COPY(DirectWriteFontFileStream)
|
||||
public:
|
||||
DirectWriteFontFileStream(const QByteArray &fontData)
|
||||
: m_fontData(fontData)
|
||||
@ -1604,7 +1605,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData,
|
||||
|
||||
void QWindowsFontDatabase::removeApplicationFonts()
|
||||
{
|
||||
foreach (const WinApplicationFont &font, m_applicationFonts) {
|
||||
for (const WinApplicationFont &font : qAsConst(m_applicationFonts)) {
|
||||
if (font.handle) {
|
||||
RemoveFontMemResourceEx(font.handle);
|
||||
} else {
|
||||
|
@ -85,6 +85,7 @@ public:
|
||||
|
||||
class QWindowsFontDatabase : public QPlatformFontDatabase
|
||||
{
|
||||
Q_DISABLE_COPY(QWindowsFontDatabase)
|
||||
public:
|
||||
enum FontOptions {
|
||||
// Relevant bits from QWindowsIntegration::Options
|
||||
@ -93,7 +94,7 @@ public:
|
||||
};
|
||||
|
||||
QWindowsFontDatabase();
|
||||
~QWindowsFontDatabase();
|
||||
~QWindowsFontDatabase() override;
|
||||
|
||||
void populateFontDatabase() override;
|
||||
void populateFamily(const QString &familyName) override;
|
||||
|
@ -66,13 +66,14 @@ class QWindowsFontEngineData;
|
||||
|
||||
class QWindowsFontEngine : public QFontEngine
|
||||
{
|
||||
Q_DISABLE_COPY(QWindowsFontEngine)
|
||||
friend class QWindowsMultiFontEngine;
|
||||
|
||||
public:
|
||||
QWindowsFontEngine(const QString &name, LOGFONT lf,
|
||||
const QSharedPointer<QWindowsFontEngineData> &fontEngineData);
|
||||
|
||||
~QWindowsFontEngine();
|
||||
~QWindowsFontEngine() override;
|
||||
void initFontInfo(const QFontDef &request,
|
||||
int dpi);
|
||||
|
||||
@ -89,7 +90,7 @@ public:
|
||||
void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const 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;
|
||||
|
||||
HGDIOBJ selectDesignFont() const;
|
||||
|
@ -69,15 +69,14 @@ namespace {
|
||||
|
||||
class GeometrySink: public IDWriteGeometrySink
|
||||
{
|
||||
Q_DISABLE_COPY(GeometrySink)
|
||||
public:
|
||||
GeometrySink(QPainterPath *path)
|
||||
: m_refCount(0), m_path(path)
|
||||
{
|
||||
Q_ASSERT(m_path != 0);
|
||||
}
|
||||
virtual ~GeometrySink()
|
||||
{
|
||||
}
|
||||
virtual ~GeometrySink() = default;
|
||||
|
||||
IFACEMETHOD_(void, AddBeziers)(const D2D1_BEZIER_SEGMENT *beziers, UINT bezierCount);
|
||||
IFACEMETHOD_(void, AddLines)(const D2D1_POINT_2F *points, UINT pointCount);
|
||||
|
@ -72,11 +72,12 @@ class QWindowsFontEngineData;
|
||||
|
||||
class QWindowsFontEngineDirectWrite : public QFontEngine
|
||||
{
|
||||
Q_DISABLE_COPY(QWindowsFontEngineDirectWrite)
|
||||
public:
|
||||
explicit QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace,
|
||||
qreal pixelSize,
|
||||
const QSharedPointer<QWindowsFontEngineData> &d);
|
||||
~QWindowsFontEngineDirectWrite();
|
||||
~QWindowsFontEngineDirectWrite() override;
|
||||
|
||||
void initFontInfo(const QFontDef &request, int dpi);
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include <QtCore/QUrl>
|
||||
|
||||
#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/QFileInfo>
|
||||
@ -172,12 +172,12 @@ static inline bool launch(const QString &launcher, const QUrl &url)
|
||||
}
|
||||
|
||||
#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:
|
||||
// OpenFile (IN s parent_window,
|
||||
@ -212,7 +212,7 @@ static inline bool flatpakOpenFile(const QUrl &url)
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool flatpakOpenUrl(const QUrl &url)
|
||||
static inline bool xdgDesktopPortalOpenUrl(const QUrl &url)
|
||||
{
|
||||
// DBus signature:
|
||||
// OpenURI (IN s parent_window,
|
||||
@ -236,7 +236,7 @@ static inline bool flatpakOpenUrl(const QUrl &url)
|
||||
return !reply.isError();
|
||||
}
|
||||
|
||||
static inline bool flatpakSendEmail(const QUrl &url)
|
||||
static inline bool xdgDesktopPortalSendEmail(const QUrl &url)
|
||||
{
|
||||
// DBus signature:
|
||||
// ComposeEmail (IN s parent_window,
|
||||
@ -294,15 +294,15 @@ bool QGenericUnixServices::openUrl(const QUrl &url)
|
||||
{
|
||||
if (url.scheme() == QLatin1String("mailto")) {
|
||||
#if QT_CONFIG(dbus)
|
||||
if (checkRunningUnderFlatpak())
|
||||
return flatpakSendEmail(url);
|
||||
if (checkNeedPortalSupport())
|
||||
return xdgDesktopPortalSendEmail(url);
|
||||
#endif
|
||||
return openDocument(url);
|
||||
}
|
||||
|
||||
#if QT_CONFIG(dbus)
|
||||
if (checkRunningUnderFlatpak())
|
||||
return flatpakOpenUrl(url);
|
||||
if (checkNeedPortalSupport())
|
||||
return xdgDesktopPortalOpenUrl(url);
|
||||
#endif
|
||||
|
||||
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)
|
||||
{
|
||||
#if QT_CONFIG(dbus)
|
||||
if (checkRunningUnderFlatpak())
|
||||
return flatpakOpenFile(url);
|
||||
if (checkNeedPortalSupport())
|
||||
return xdgDesktopPortalOpenFile(url);
|
||||
#endif
|
||||
|
||||
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
|
||||
QT_FOR_CONFIG += widgets-private
|
||||
|
||||
qtConfig(dbus):qtConfig(regularexpression): SUBDIRS += flatpak
|
||||
qtConfig(dbus):qtConfig(regularexpression): SUBDIRS += xdgdesktopportal
|
||||
|
||||
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/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
@ -38,24 +38,26 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <qpa/qplatformthemeplugin.h>
|
||||
#include "qflatpaktheme.h"
|
||||
#include "qxdgdesktopportaltheme.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QFlatpakThemePlugin : public QPlatformThemePlugin
|
||||
class QXdgDesktopPortalThemePlugin : public QPlatformThemePlugin
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PLUGIN_METADATA(IID QPlatformThemeFactoryInterface_iid FILE "flatpak.json")
|
||||
Q_PLUGIN_METADATA(IID QPlatformThemeFactoryInterface_iid FILE "xdgdesktopportal.json")
|
||||
|
||||
public:
|
||||
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);
|
||||
if (!key.compare(QLatin1String("flatpak"), Qt::CaseInsensitive))
|
||||
return new QFlatpakTheme;
|
||||
if (!key.compare(QLatin1String("xdgdesktopportal"), Qt::CaseInsensitive) ||
|
||||
!key.compare(QLatin1String("flatpak"), Qt::CaseInsensitive) ||
|
||||
!key.compare(QLatin1String("snap"), Qt::CaseInsensitive))
|
||||
return new QXdgDesktopPortalTheme;
|
||||
|
||||
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/
|
||||
**
|
||||
** 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>
|
||||
|
||||
@ -56,7 +56,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::FilterCondition &filterCondition)
|
||||
QDBusArgument &operator <<(QDBusArgument &arg, const QXdgDesktopPortalFileDialog::FilterCondition &filterCondition)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << filterCondition.type << filterCondition.pattern;
|
||||
@ -64,20 +64,20 @@ QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::FilterC
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator >>(const QDBusArgument &arg, QFlatpakFileDialog::FilterCondition &filterCondition)
|
||||
const QDBusArgument &operator >>(const QDBusArgument &arg, QXdgDesktopPortalFileDialog::FilterCondition &filterCondition)
|
||||
{
|
||||
uint type;
|
||||
QString filterPattern;
|
||||
arg.beginStructure();
|
||||
arg >> type >> filterPattern;
|
||||
filterCondition.type = (QFlatpakFileDialog::ConditionType)type;
|
||||
filterCondition.type = (QXdgDesktopPortalFileDialog::ConditionType)type;
|
||||
filterCondition.pattern = filterPattern;
|
||||
arg.endStructure();
|
||||
|
||||
return arg;
|
||||
}
|
||||
|
||||
QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::Filter filter)
|
||||
QDBusArgument &operator <<(QDBusArgument &arg, const QXdgDesktopPortalFileDialog::Filter filter)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << filter.name << filter.filterConditions;
|
||||
@ -85,10 +85,10 @@ QDBusArgument &operator <<(QDBusArgument &arg, const QFlatpakFileDialog::Filter
|
||||
return arg;
|
||||
}
|
||||
|
||||
const QDBusArgument &operator >>(const QDBusArgument &arg, QFlatpakFileDialog::Filter &filter)
|
||||
const QDBusArgument &operator >>(const QDBusArgument &arg, QXdgDesktopPortalFileDialog::Filter &filter)
|
||||
{
|
||||
QString name;
|
||||
QFlatpakFileDialog::FilterConditionList filterConditions;
|
||||
QXdgDesktopPortalFileDialog::FilterConditionList filterConditions;
|
||||
arg.beginStructure();
|
||||
arg >> name >> filterConditions;
|
||||
filter.name = name;
|
||||
@ -98,10 +98,10 @@ const QDBusArgument &operator >>(const QDBusArgument &arg, QFlatpakFileDialog::F
|
||||
return arg;
|
||||
}
|
||||
|
||||
class QFlatpakFileDialogPrivate
|
||||
class QXdgDesktopPortalFileDialogPrivate
|
||||
{
|
||||
public:
|
||||
QFlatpakFileDialogPrivate(QPlatformFileDialogHelper *nativeFileDialog)
|
||||
QXdgDesktopPortalFileDialogPrivate(QPlatformFileDialogHelper *nativeFileDialog)
|
||||
: nativeFileDialog(nativeFileDialog)
|
||||
{ }
|
||||
|
||||
@ -118,11 +118,11 @@ public:
|
||||
QPlatformFileDialogHelper *nativeFileDialog = nullptr;
|
||||
};
|
||||
|
||||
QFlatpakFileDialog::QFlatpakFileDialog(QPlatformFileDialogHelper *nativeFileDialog)
|
||||
QXdgDesktopPortalFileDialog::QXdgDesktopPortalFileDialog(QPlatformFileDialogHelper *nativeFileDialog)
|
||||
: QPlatformFileDialogHelper()
|
||||
, d_ptr(new QFlatpakFileDialogPrivate(nativeFileDialog))
|
||||
, d_ptr(new QXdgDesktopPortalFileDialogPrivate(nativeFileDialog))
|
||||
{
|
||||
Q_D(QFlatpakFileDialog);
|
||||
Q_D(QXdgDesktopPortalFileDialog);
|
||||
|
||||
if (d->nativeFileDialog) {
|
||||
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)
|
||||
d->nativeFileDialog->setOptions(options());
|
||||
@ -162,9 +162,9 @@ void QFlatpakFileDialog::initializeDialog()
|
||||
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"),
|
||||
QLatin1String("/org/freedesktop/portal/desktop"),
|
||||
@ -270,14 +270,14 @@ void QFlatpakFileDialog::openPortal()
|
||||
});
|
||||
}
|
||||
|
||||
bool QFlatpakFileDialog::defaultNameFilterDisables() const
|
||||
bool QXdgDesktopPortalFileDialog::defaultNameFilterDisables() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void QFlatpakFileDialog::setDirectory(const QUrl &directory)
|
||||
void QXdgDesktopPortalFileDialog::setDirectory(const QUrl &directory)
|
||||
{
|
||||
Q_D(QFlatpakFileDialog);
|
||||
Q_D(QXdgDesktopPortalFileDialog);
|
||||
|
||||
if (d->nativeFileDialog) {
|
||||
d->nativeFileDialog->setOptions(options());
|
||||
@ -287,9 +287,9 @@ void QFlatpakFileDialog::setDirectory(const QUrl &directory)
|
||||
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))
|
||||
return d->nativeFileDialog->directory();
|
||||
@ -297,9 +297,9 @@ QUrl QFlatpakFileDialog::directory() const
|
||||
return d->directory;
|
||||
}
|
||||
|
||||
void QFlatpakFileDialog::selectFile(const QUrl &filename)
|
||||
void QXdgDesktopPortalFileDialog::selectFile(const QUrl &filename)
|
||||
{
|
||||
Q_D(QFlatpakFileDialog);
|
||||
Q_D(QXdgDesktopPortalFileDialog);
|
||||
|
||||
if (d->nativeFileDialog) {
|
||||
d->nativeFileDialog->setOptions(options());
|
||||
@ -309,9 +309,9 @@ void QFlatpakFileDialog::selectFile(const QUrl &filename)
|
||||
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))
|
||||
return d->nativeFileDialog->selectedFiles();
|
||||
@ -323,9 +323,9 @@ QList<QUrl> QFlatpakFileDialog::selectedFiles() const
|
||||
return files;
|
||||
}
|
||||
|
||||
void QFlatpakFileDialog::setFilter()
|
||||
void QXdgDesktopPortalFileDialog::setFilter()
|
||||
{
|
||||
Q_D(QFlatpakFileDialog);
|
||||
Q_D(QXdgDesktopPortalFileDialog);
|
||||
|
||||
if (d->nativeFileDialog) {
|
||||
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) {
|
||||
d->nativeFileDialog->setOptions(options());
|
||||
@ -343,15 +343,15 @@ void QFlatpakFileDialog::selectNameFilter(const QString &filter)
|
||||
}
|
||||
}
|
||||
|
||||
QString QFlatpakFileDialog::selectedNameFilter() const
|
||||
QString QXdgDesktopPortalFileDialog::selectedNameFilter() const
|
||||
{
|
||||
// TODO
|
||||
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)) {
|
||||
d->nativeFileDialog->exec();
|
||||
@ -365,17 +365,17 @@ void QFlatpakFileDialog::exec()
|
||||
loop.exec();
|
||||
}
|
||||
|
||||
void QFlatpakFileDialog::hide()
|
||||
void QXdgDesktopPortalFileDialog::hide()
|
||||
{
|
||||
Q_D(QFlatpakFileDialog);
|
||||
Q_D(QXdgDesktopPortalFileDialog);
|
||||
|
||||
if (d->nativeFileDialog)
|
||||
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();
|
||||
|
||||
@ -390,9 +390,9 @@ bool QFlatpakFileDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality wi
|
||||
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 (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/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
@ -36,20 +36,20 @@
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QFLATPAKFILEDIALOG_P_H
|
||||
#define QFLATPAKFILEDIALOG_P_H
|
||||
#ifndef QXDGDESKTOPPORTALFILEDIALOG_P_H
|
||||
#define QXDGDESKTOPPORTALFILEDIALOG_P_H
|
||||
|
||||
#include <qpa/qplatformdialoghelper.h>
|
||||
#include <QVector>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QFlatpakFileDialogPrivate;
|
||||
class QXdgDesktopPortalFileDialogPrivate;
|
||||
|
||||
class QFlatpakFileDialog : public QPlatformFileDialogHelper
|
||||
class QXdgDesktopPortalFileDialog : public QPlatformFileDialogHelper
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QFlatpakFileDialog)
|
||||
Q_DECLARE_PRIVATE(QXdgDesktopPortalFileDialog)
|
||||
public:
|
||||
enum ConditionType : uint {
|
||||
GlobalPattern = 0,
|
||||
@ -69,8 +69,8 @@ public:
|
||||
};
|
||||
typedef QVector<Filter> FilterList;
|
||||
|
||||
QFlatpakFileDialog(QPlatformFileDialogHelper *nativeFileDialog = nullptr);
|
||||
~QFlatpakFileDialog();
|
||||
QXdgDesktopPortalFileDialog(QPlatformFileDialogHelper *nativeFileDialog = nullptr);
|
||||
~QXdgDesktopPortalFileDialog();
|
||||
|
||||
bool defaultNameFilterDisables() const override;
|
||||
QUrl directory() const override;
|
||||
@ -92,15 +92,15 @@ private:
|
||||
void initializeDialog();
|
||||
void openPortal();
|
||||
|
||||
QScopedPointer<QFlatpakFileDialogPrivate> d_ptr;
|
||||
QScopedPointer<QXdgDesktopPortalFileDialogPrivate> d_ptr;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterCondition);
|
||||
Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterConditionList);
|
||||
Q_DECLARE_METATYPE(QFlatpakFileDialog::Filter);
|
||||
Q_DECLARE_METATYPE(QFlatpakFileDialog::FilterList);
|
||||
Q_DECLARE_METATYPE(QXdgDesktopPortalFileDialog::FilterCondition);
|
||||
Q_DECLARE_METATYPE(QXdgDesktopPortalFileDialog::FilterConditionList);
|
||||
Q_DECLARE_METATYPE(QXdgDesktopPortalFileDialog::Filter);
|
||||
Q_DECLARE_METATYPE(QXdgDesktopPortalFileDialog::FilterList);
|
||||
|
||||
#endif // QFLATPAKFILEDIALOG_P_H
|
||||
#endif // QXDGDESKTOPPORTALFILEDIALOG_P_H
|
||||
|
@ -37,8 +37,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "qflatpaktheme.h"
|
||||
#include "qflatpakfiledialog_p.h"
|
||||
#include "qxdgdesktopportaltheme.h"
|
||||
#include "qxdgdesktopportalfiledialog_p.h"
|
||||
|
||||
#include <private/qguiapplication_p.h>
|
||||
#include <qpa/qplatformtheme_p.h>
|
||||
@ -47,14 +47,14 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QFlatpakThemePrivate : public QPlatformThemePrivate
|
||||
class QXdgDesktopPortalThemePrivate : public QPlatformThemePrivate
|
||||
{
|
||||
public:
|
||||
QFlatpakThemePrivate()
|
||||
QXdgDesktopPortalThemePrivate()
|
||||
: QPlatformThemePrivate()
|
||||
{ }
|
||||
|
||||
~QFlatpakThemePrivate()
|
||||
~QXdgDesktopPortalThemePrivate()
|
||||
{
|
||||
delete baseTheme;
|
||||
}
|
||||
@ -62,10 +62,10 @@ public:
|
||||
QPlatformTheme *baseTheme;
|
||||
};
|
||||
|
||||
QFlatpakTheme::QFlatpakTheme()
|
||||
: d_ptr(new QFlatpakThemePrivate)
|
||||
QXdgDesktopPortalTheme::QXdgDesktopPortalTheme()
|
||||
: d_ptr(new QXdgDesktopPortalThemePrivate)
|
||||
{
|
||||
Q_D(QFlatpakTheme);
|
||||
Q_D(QXdgDesktopPortalTheme);
|
||||
|
||||
QStringList themeNames;
|
||||
themeNames += QGuiApplicationPrivate::platform_integration->themeNames();
|
||||
@ -92,33 +92,33 @@ QFlatpakTheme::QFlatpakTheme()
|
||||
d->baseTheme = new QPlatformTheme;
|
||||
}
|
||||
|
||||
QPlatformMenuItem* QFlatpakTheme::createPlatformMenuItem() const
|
||||
QPlatformMenuItem* QXdgDesktopPortalTheme::createPlatformMenuItem() const
|
||||
{
|
||||
Q_D(const QFlatpakTheme);
|
||||
Q_D(const QXdgDesktopPortalTheme);
|
||||
return d->baseTheme->createPlatformMenuItem();
|
||||
}
|
||||
|
||||
QPlatformMenu* QFlatpakTheme::createPlatformMenu() const
|
||||
QPlatformMenu* QXdgDesktopPortalTheme::createPlatformMenu() const
|
||||
{
|
||||
Q_D(const QFlatpakTheme);
|
||||
Q_D(const QXdgDesktopPortalTheme);
|
||||
return d->baseTheme->createPlatformMenu();
|
||||
}
|
||||
|
||||
QPlatformMenuBar* QFlatpakTheme::createPlatformMenuBar() const
|
||||
QPlatformMenuBar* QXdgDesktopPortalTheme::createPlatformMenuBar() const
|
||||
{
|
||||
Q_D(const QFlatpakTheme);
|
||||
Q_D(const QXdgDesktopPortalTheme);
|
||||
return d->baseTheme->createPlatformMenuBar();
|
||||
}
|
||||
|
||||
void QFlatpakTheme::showPlatformMenuBar()
|
||||
void QXdgDesktopPortalTheme::showPlatformMenuBar()
|
||||
{
|
||||
Q_D(const QFlatpakTheme);
|
||||
Q_D(const QXdgDesktopPortalTheme);
|
||||
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)
|
||||
return true;
|
||||
@ -126,74 +126,74 @@ bool QFlatpakTheme::usePlatformNativeDialog(DialogType type) const
|
||||
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 (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);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_SYSTEMTRAYICON
|
||||
QPlatformSystemTrayIcon* QFlatpakTheme::createPlatformSystemTrayIcon() const
|
||||
QPlatformSystemTrayIcon* QXdgDesktopPortalTheme::createPlatformSystemTrayIcon() const
|
||||
{
|
||||
Q_D(const QFlatpakTheme);
|
||||
Q_D(const QXdgDesktopPortalTheme);
|
||||
return d->baseTheme->createPlatformSystemTrayIcon();
|
||||
}
|
||||
#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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
QIcon QFlatpakTheme::fileIcon(const QFileInfo &fileInfo,
|
||||
QIcon QXdgDesktopPortalTheme::fileIcon(const QFileInfo &fileInfo,
|
||||
QPlatformTheme::IconOptions iconOptions) const
|
||||
{
|
||||
Q_D(const QFlatpakTheme);
|
||||
Q_D(const QXdgDesktopPortalTheme);
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -37,20 +37,20 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QFLATPAKTHEME_H
|
||||
#define QFLATPAKTHEME_H
|
||||
#ifndef QXDGDESKTOPPORTALTHEME_H
|
||||
#define QXDGDESKTOPPORTALTHEME_H
|
||||
|
||||
#include <qpa/qplatformtheme.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QFlatpakThemePrivate;
|
||||
class QXdgDesktopPortalThemePrivate;
|
||||
|
||||
class QFlatpakTheme : public QPlatformTheme
|
||||
class QXdgDesktopPortalTheme : public QPlatformTheme
|
||||
{
|
||||
Q_DECLARE_PRIVATE(QFlatpakTheme)
|
||||
Q_DECLARE_PRIVATE(QXdgDesktopPortalTheme)
|
||||
public:
|
||||
QFlatpakTheme();
|
||||
QXdgDesktopPortalTheme();
|
||||
|
||||
QPlatformMenuItem *createPlatformMenuItem() const override;
|
||||
QPlatformMenu *createPlatformMenu() const override;
|
||||
@ -81,10 +81,10 @@ public:
|
||||
QString standardButtonText(int button) const override;
|
||||
|
||||
private:
|
||||
QScopedPointer<QFlatpakThemePrivate> d_ptr;
|
||||
Q_DISABLE_COPY(QFlatpakTheme)
|
||||
QScopedPointer<QXdgDesktopPortalThemePrivate> d_ptr;
|
||||
Q_DISABLE_COPY(QXdgDesktopPortalTheme)
|
||||
};
|
||||
|
||||
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
|
||||
{
|
||||
Q_DISABLE_COPY(QWindowsPrinterSupport)
|
||||
public:
|
||||
QWindowsPrinterSupport();
|
||||
~QWindowsPrinterSupport();
|
||||
~QWindowsPrinterSupport() override;
|
||||
|
||||
QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) override;
|
||||
QPaintEngine *createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode) override;
|
||||
|
@ -179,9 +179,7 @@ QWindowsVistaStyle::QWindowsVistaStyle()
|
||||
/*!
|
||||
Destructor.
|
||||
*/
|
||||
QWindowsVistaStyle::~QWindowsVistaStyle()
|
||||
{
|
||||
}
|
||||
QWindowsVistaStyle::~QWindowsVistaStyle() = default;
|
||||
|
||||
//convert Qt state flags to uxtheme button states
|
||||
static int buttonStateId(int flags, int partId)
|
||||
|
@ -62,38 +62,41 @@ class QWindowsVistaStyle : public QWindowsXPStyle
|
||||
Q_OBJECT
|
||||
public:
|
||||
QWindowsVistaStyle();
|
||||
~QWindowsVistaStyle();
|
||||
~QWindowsVistaStyle() override;
|
||||
|
||||
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,
|
||||
QPainter *painter, const QWidget *widget) const;
|
||||
QPainter *painter, const QWidget *widget) const override;
|
||||
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,
|
||||
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,
|
||||
SubControl sc, const QWidget *widget) const;
|
||||
SubControl sc, const QWidget *widget) const override;
|
||||
|
||||
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,
|
||||
const QWidget *widget = 0) const;
|
||||
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
|
||||
const QWidget *widget = nullptr) const override;
|
||||
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt,
|
||||
const QWidget *widget = 0) const;
|
||||
int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const;
|
||||
int styleHint(StyleHint hint, const QStyleOption *opt = 0, const QWidget *widget = 0,
|
||||
QStyleHintReturn *returnData = 0) const;
|
||||
const QWidget *widget = nullptr) const override;
|
||||
int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
|
||||
const QWidget *widget = nullptr) const override;
|
||||
int styleHint(StyleHint hint, const QStyleOption *opt = nullptr,
|
||||
const QWidget *widget = nullptr, QStyleHintReturn *returnData = nullptr) const override;
|
||||
|
||||
void polish(QWidget *widget);
|
||||
void unpolish(QWidget *widget);
|
||||
void polish(QPalette &pal);
|
||||
void polish(QApplication *app);
|
||||
void unpolish(QApplication *app);
|
||||
QPalette standardPalette() const;
|
||||
void polish(QWidget *widget) override;
|
||||
void unpolish(QWidget *widget) override;
|
||||
void polish(QPalette &pal) override;
|
||||
void polish(QApplication *app) override;
|
||||
void unpolish(QApplication *app) override;
|
||||
QPalette standardPalette() const override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QWindowsVistaStyle)
|
||||
|
@ -63,35 +63,37 @@ class QWindowsXPStyle : public QWindowsStyle
|
||||
public:
|
||||
QWindowsXPStyle();
|
||||
QWindowsXPStyle(QWindowsXPStylePrivate &dd);
|
||||
~QWindowsXPStyle();
|
||||
~QWindowsXPStyle() override;
|
||||
|
||||
void unpolish(QApplication*);
|
||||
void polish(QApplication*);
|
||||
void polish(QWidget*);
|
||||
void polish(QPalette&);
|
||||
void unpolish(QWidget*);
|
||||
void unpolish(QApplication*) override;
|
||||
void polish(QApplication*) override;
|
||||
void polish(QWidget*) override;
|
||||
void polish(QPalette&) override;
|
||||
void unpolish(QWidget*) override;
|
||||
|
||||
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,
|
||||
const QWidget *wwidget = 0) const;
|
||||
QRect subElementRect(SubElement r, const QStyleOption *option, const QWidget *widget = 0) const;
|
||||
const QWidget *wwidget = nullptr) const override;
|
||||
QRect subElementRect(SubElement r, const QStyleOption *option,
|
||||
const QWidget *widget = nullptr) const override;
|
||||
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,
|
||||
const QWidget *widget = 0) const;
|
||||
const QWidget *widget = nullptr) const override;
|
||||
QSize sizeFromContents(ContentsType ct, const QStyleOption *option, const QSize &contentsSize,
|
||||
const QWidget *widget = 0) const;
|
||||
int pixelMetric(PixelMetric pm, const QStyleOption *option = 0,
|
||||
const QWidget *widget = 0) const;
|
||||
int styleHint(StyleHint hint, const QStyleOption *option = 0, const QWidget *widget = 0,
|
||||
QStyleHintReturn *returnData = 0) const;
|
||||
const QWidget *widget = nullptr) const override;
|
||||
int pixelMetric(PixelMetric pm, const QStyleOption *option = nullptr,
|
||||
const QWidget *widget = nullptr) const override;
|
||||
int styleHint(StyleHint hint, const QStyleOption *option = nullptr,
|
||||
const QWidget *widget = nullptr,
|
||||
QStyleHintReturn *returnData = nullptr) const override;
|
||||
|
||||
QPalette standardPalette() const;
|
||||
QPalette standardPalette() const override;
|
||||
QPixmap standardPixmap(StandardPixmap standardIcon, const QStyleOption *option,
|
||||
const QWidget *widget = 0) const;
|
||||
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
|
||||
const QWidget *widget = 0) const;
|
||||
const QWidget *widget = nullptr) const override;
|
||||
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
|
||||
const QWidget *widget = nullptr) const override;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QWindowsXPStyle)
|
||||
|
@ -71,22 +71,23 @@ class QVistaBackButton : public QAbstractButton
|
||||
public:
|
||||
QVistaBackButton(QWidget *widget);
|
||||
|
||||
QSize sizeHint() const;
|
||||
inline QSize minimumSizeHint() const
|
||||
QSize sizeHint() const override;
|
||||
inline QSize minimumSizeHint() const override
|
||||
{ return sizeHint(); }
|
||||
|
||||
void enterEvent(QEvent *event);
|
||||
void leaveEvent(QEvent *event);
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void enterEvent(QEvent *event) override;
|
||||
void leaveEvent(QEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
};
|
||||
|
||||
class QWizard;
|
||||
|
||||
class QVistaHelper : public QObject
|
||||
{
|
||||
Q_DISABLE_COPY(QVistaHelper)
|
||||
public:
|
||||
QVistaHelper(QWizard *wizard);
|
||||
~QVistaHelper();
|
||||
~QVistaHelper() override;
|
||||
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
|
||||
void updateCustomMargins(bool vistaMargins);
|
||||
bool setDWMTitleBar(TitleBarChangeType type);
|
||||
@ -133,7 +134,7 @@ private:
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
|
||||
static int instanceCount;
|
||||
static VistaState cachedVistaState;
|
||||
|
Loading…
x
Reference in New Issue
Block a user