drop unused QSharedMemory and QSystemSemaphore classes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-02-28 17:06:54 +02:00
parent 1f1143c75f
commit c4100aae81
17 changed files with 165 additions and 1989 deletions

View file

@ -141,7 +141,6 @@ include/katie/QtCore/QSetIterator
include/katie/QtCore/QSettings
include/katie/QtCore/QSharedData
include/katie/QtCore/QSharedDataPointer
include/katie/QtCore/QSharedMemory
include/katie/QtCore/QSharedPointer
include/katie/QtCore/QSignalMapper
include/katie/QtCore/QSize
@ -154,7 +153,6 @@ include/katie/QtCore/QStringList
include/katie/QtCore/QStringListIterator
include/katie/QtCore/QStringMatcher
include/katie/QtCore/QStringRef
include/katie/QtCore/QSystemSemaphore
include/katie/QtCore/QTemporaryFile
include/katie/QtCore/QTextBoundaryFinder
include/katie/QtCore/QTextCodec
@ -277,7 +275,6 @@ include/katie/QtCore/qsemaphore.h
include/katie/QtCore/qset.h
include/katie/QtCore/qsettings.h
include/katie/QtCore/qshareddata.h
include/katie/QtCore/qsharedmemory.h
include/katie/QtCore/qsharedpointer.h
include/katie/QtCore/qsignalmapper.h
include/katie/QtCore/qsize.h
@ -287,7 +284,6 @@ include/katie/QtCore/qstandardpaths.h
include/katie/QtCore/qstring.h
include/katie/QtCore/qstringlist.h
include/katie/QtCore/qstringmatcher.h
include/katie/QtCore/qsystemsemaphore.h
include/katie/QtCore/qtconcurrentcompilertest.h
include/katie/QtCore/qtconcurrentexception.h
include/katie/QtCore/qtconcurrentfilter.h

View file

@ -144,7 +144,6 @@ include/katie/QtCore/QSetIterator
include/katie/QtCore/QSettings
include/katie/QtCore/QSharedData
include/katie/QtCore/QSharedDataPointer
include/katie/QtCore/QSharedMemory
include/katie/QtCore/QSharedPointer
include/katie/QtCore/QSignalMapper
include/katie/QtCore/QSize
@ -157,7 +156,6 @@ include/katie/QtCore/QStringList
include/katie/QtCore/QStringListIterator
include/katie/QtCore/QStringMatcher
include/katie/QtCore/QStringRef
include/katie/QtCore/QSystemSemaphore
include/katie/QtCore/QTemporaryFile
include/katie/QtCore/QTextBoundaryFinder
include/katie/QtCore/QTextCodec
@ -280,7 +278,6 @@ include/katie/QtCore/qsemaphore.h
include/katie/QtCore/qset.h
include/katie/QtCore/qsettings.h
include/katie/QtCore/qshareddata.h
include/katie/QtCore/qsharedmemory.h
include/katie/QtCore/qsharedpointer.h
include/katie/QtCore/qsignalmapper.h
include/katie/QtCore/qsize.h
@ -290,7 +287,6 @@ include/katie/QtCore/qstandardpaths.h
include/katie/QtCore/qstring.h
include/katie/QtCore/qstringlist.h
include/katie/QtCore/qstringmatcher.h
include/katie/QtCore/qsystemsemaphore.h
include/katie/QtCore/qtconcurrentcompilertest.h
include/katie/QtCore/qtconcurrentexception.h
include/katie/QtCore/qtconcurrentfilter.h

View file

@ -144,7 +144,6 @@ include/katie/QtCore/QSetIterator
include/katie/QtCore/QSettings
include/katie/QtCore/QSharedData
include/katie/QtCore/QSharedDataPointer
include/katie/QtCore/QSharedMemory
include/katie/QtCore/QSharedPointer
include/katie/QtCore/QSignalMapper
include/katie/QtCore/QSize
@ -157,7 +156,6 @@ include/katie/QtCore/QStringList
include/katie/QtCore/QStringListIterator
include/katie/QtCore/QStringMatcher
include/katie/QtCore/QStringRef
include/katie/QtCore/QSystemSemaphore
include/katie/QtCore/QTemporaryFile
include/katie/QtCore/QTextBoundaryFinder
include/katie/QtCore/QTextCodec
@ -280,7 +278,6 @@ include/katie/QtCore/qsemaphore.h
include/katie/QtCore/qset.h
include/katie/QtCore/qsettings.h
include/katie/QtCore/qshareddata.h
include/katie/QtCore/qsharedmemory.h
include/katie/QtCore/qsharedpointer.h
include/katie/QtCore/qsignalmapper.h
include/katie/QtCore/qsize.h
@ -290,7 +287,6 @@ include/katie/QtCore/qstandardpaths.h
include/katie/QtCore/qstring.h
include/katie/QtCore/qstringlist.h
include/katie/QtCore/qstringmatcher.h
include/katie/QtCore/qsystemsemaphore.h
include/katie/QtCore/qtconcurrentcompilertest.h
include/katie/QtCore/qtconcurrentexception.h
include/katie/QtCore/qtconcurrentfilter.h

View file

@ -483,7 +483,6 @@ classlist = [
"QSettings",
"QSharedData",
"QSharedDataPointer",
"QSharedMemory",
"QSharedPointer",
"QShortcut",
"QShortcutEvent",
@ -565,7 +564,6 @@ classlist = [
"QStylePlugin",
"QSvgRenderer",
"QSyntaxHighlighter",
"QSystemSemaphore",
"QSystemTrayIcon",
"Qt",
"QTabBar",

View file

@ -10,7 +10,6 @@ set(EXTRA_CORE_LIBS
set(CORE_PUBLIC_HEADERS
QVarLengthArray
QList
QSystemSemaphore
QProcess
QBuffer
QStringMatcher
@ -70,7 +69,6 @@ set(CORE_PUBLIC_HEADERS
QMargins
QByteArrayMatcher
QDirIterator
QSharedMemory
QReadWriteLock
QFileSystemWatcher
QSharedPointer
@ -205,10 +203,6 @@ set(CORE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qvariant_p.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qmetaobject_p.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qobject_p.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsharedmemory.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsharedmemory_p.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsystemsemaphore.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsystemsemaphore_p.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qmath.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qcore_unix_p.h
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qeventdispatcher_unix_p.h
@ -341,12 +335,8 @@ set(CORE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qtimer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qtranslator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qvariant.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsharedmemory.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsystemsemaphore.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qpointer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qcore_unix.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsharedmemory_unix.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qsystemsemaphore_unix.cpp
${CMAKE_CURRENT_SOURCE_DIR}/kernel/qeventdispatcher_unix.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/qpluginloader.cpp
${CMAKE_CURRENT_SOURCE_DIR}/plugin/qfactoryloader.cpp

View file

@ -205,7 +205,6 @@
#cmakedefine QT_NO_PRINTPREVIEWWIDGET
#cmakedefine QT_NO_PROGRESSDIALOG
#cmakedefine QT_NO_QUUID_STRING
#cmakedefine QT_NO_SHAREDMEMORY
#cmakedefine QT_NO_SIZEGRIP
#cmakedefine QT_NO_SPLASHSCREEN
#cmakedefine QT_NO_STRINGLISTMODEL
@ -214,7 +213,6 @@
#cmakedefine QT_NO_STYLE_STYLESHEET
#cmakedefine QT_NO_STYLE_WINDOWS
#cmakedefine QT_NO_SYNTAXHIGHLIGHTER
#cmakedefine QT_NO_SYSTEMSEMAPHORE
#cmakedefine QT_NO_SYSTEMTRAYICON
#cmakedefine QT_NO_TEXTBROWSER
#cmakedefine QT_NO_UDPSOCKET

View file

@ -1,551 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qsharedmemory.h"
#include "qsharedmemory_p.h"
#include "qsystemsemaphore.h"
#include "qdir.h"
#include "qdebug.h"
QT_BEGIN_NAMESPACE
#if !(defined(QT_NO_SHAREDMEMORY) && defined(QT_NO_SYSTEMSEMAPHORE))
/*!
\internal
Generate a string from the key which can be any unicode string into
the subset that the win/unix kernel allows.
On Unix this will be a file name
*/
QString QSharedMemoryPrivate::makePlatformSafeKey(const QString &key, const QString &prefix)
{
Q_ASSERT(prefix.startsWith(QLatin1Char('/')));
if (key.isEmpty())
return QString();
return (prefix + key.toUtf8().toHex());
}
#endif // QT_NO_SHAREDMEMORY && QT_NO_SHAREDMEMORY
#ifndef QT_NO_SHAREDMEMORY
/*!
\class QSharedMemory
\since 4.4
\brief The QSharedMemory class provides access to a shared memory segment.
QSharedMemory provides access to a shared memory segment by multiple
threads and processes. It also provides a way for a single thread or
process to lock the memory for exclusive access.
When using this class, be aware of the following platform
differences:
\list
\o Unix: QSharedMemory "owns" the shared memory segment. When the
last thread or process that has an instance of QSharedMemory
attached to a particular shared memory segment detaches from the
segment by destroying its instance of QSharedMemory, the Unix kernel
release the shared memory segment. But if that last thread or
process crashes without running the QSharedMemory destructor, the
shared memory segment survives the crash.
\o HP-UX: Only one attach to a shared memory segment is allowed per
process. This means that QSharedMemory should not be used across
multiple threads in the same process in HP-UX.
\endlist
Remember to lock the shared memory with lock() before reading from
or writing to the shared memory, and remember to release the lock
with unlock() after you are done.
Unlike QtSharedMemory, QSharedMemory automatically destroys the
shared memory segment when the last instance of QSharedMemory is
detached from the segment, and no references to the segment
remain. Do not mix using QtSharedMemory and QSharedMemory. Port
everything to QSharedMemory.
\warning QSharedMemory changes the key in a Qt-specific way, unless otherwise
specified. Interoperation with non-Qt applications is achieved by first creating
a default shared memory with QSharedMemory() and then setting a native key with
setNativeKey(). When using native keys, shared memory is not protected against
multiple accesses on it (e.g. unable to lock()) and a user-defined mechanism
should be used to achieve a such protection.
*/
/*!
\overload QSharedMemory()
Constructs a shared memory object with the given \a parent. The
shared memory object's key is not set by the constructor, so the
shared memory object does not have an underlying shared memory
segment attached. The key must be set with setKey() or setNativeKey()
before create() or attach() can be used.
\sa setKey()
*/
QSharedMemory::QSharedMemory(QObject *parent)
: QObject(*new QSharedMemoryPrivate, parent)
{
}
/*!
Constructs a shared memory object with the given \a parent and with
its key set to \a key. Because its key is set, its create() and
attach() functions can be called.
\sa setKey(), create(), attach()
*/
QSharedMemory::QSharedMemory(const QString &key, QObject *parent)
: QObject(*new QSharedMemoryPrivate, parent)
{
setKey(key);
}
/*!
The destructor clears the key, which forces the shared memory object
to \l {detach()} {detach} from its underlying shared memory
segment. If this shared memory object is the last one connected to
the shared memory segment, the detach() operation destroys the
shared memory segment.
\sa detach() isAttached()
*/
QSharedMemory::~QSharedMemory()
{
setKey(QString());
}
/*!
Sets the platform independent \a key for this shared memory object. If \a key
is the same as the current key, the function returns without doing anything.
You can call key() to retrieve the platform independent key. Internally,
QSharedMemory converts this key into a platform specific key. If you instead
call nativeKey(), you will get the platform specific, converted key.
If the shared memory object is attached to an underlying shared memory
segment, it will \l {detach()} {detach} from it before setting the new key.
This function does not do an attach().
\sa key() nativeKey() isAttached()
*/
void QSharedMemory::setKey(const QString &key)
{
Q_D(QSharedMemory);
if (key == d->key && d->makePlatformSafeKey(key) == d->nativeKey)
return;
if (isAttached())
detach();
d->cleanHandle();
d->key = key;
d->nativeKey = d->makePlatformSafeKey(key);
}
/*!
\since 4.8
Sets the native, platform specific, \a key for this shared memory object. If
\a key is the same as the current native key, the function returns without
doing anything. If all you want is to assign a key to a segment, you should
call setKey() instead.
You can call nativeKey() to retrieve the native key. If a native key has been
assigned, calling key() will return a null string.
If the shared memory object is attached to an underlying shared memory
segment, it will \l {detach()} {detach} from it before setting the new key.
This function does not do an attach().
The application will not be portable if you set a native key.
\sa nativeKey() key() isAttached()
*/
void QSharedMemory::setNativeKey(const QString &key)
{
Q_D(QSharedMemory);
if (key == d->nativeKey && d->key.isNull())
return;
if (isAttached())
detach();
d->cleanHandle();
d->key.clear();
d->nativeKey = key;
}
bool QSharedMemoryPrivate::initKey()
{
cleanHandle();
#ifndef QT_NO_SYSTEMSEMAPHORE
systemSemaphore.setKey(QString(), 1);
systemSemaphore.setKey(key, 1);
if (systemSemaphore.error() != QSystemSemaphore::NoError) {
errorString = QSharedMemory::tr("%1: unable to set key on lock").arg(QLatin1String("QSharedMemoryPrivate::initKey"));
switch(systemSemaphore.error()) {
case QSystemSemaphore::PermissionDenied:
error = QSharedMemory::PermissionDenied;
break;
case QSystemSemaphore::KeyError:
error = QSharedMemory::KeyError;
break;
case QSystemSemaphore::AlreadyExists:
error = QSharedMemory::AlreadyExists;
break;
case QSystemSemaphore::NotFound:
error = QSharedMemory::NotFound;
break;
case QSystemSemaphore::OutOfResources:
error = QSharedMemory::OutOfResources;
break;
case QSystemSemaphore::UnknownError:
default:
error = QSharedMemory::UnknownError;
break;
}
return false;
}
#endif
errorString.clear();
error = QSharedMemory::NoError;
return true;
}
/*!
Returns the key assigned with setKey() to this shared memory, or a null key
if no key has been assigned, or if the segment is using a nativeKey(). The
key is the identifier used by Qt applications to identify the shared memory
segment.
You can find the native, platform specific, key used by the operating system
by calling nativeKey().
\sa setKey() setNativeKey()
*/
QString QSharedMemory::key() const
{
Q_D(const QSharedMemory);
return d->key;
}
/*!
\since 4.8
Returns the native, platform specific, key for this shared memory object. The
native key is the identifier used by the operating system to identify the
shared memory segment.
You can use the native key to access shared memory segments that have not
been created by Qt, or to grant shared memory access to non-Qt applications.
\sa setKey() setNativeKey()
*/
QString QSharedMemory::nativeKey() const
{
Q_D(const QSharedMemory);
return d->nativeKey;
}
/*!
Creates a shared memory segment of \a size bytes with the key passed to the
constructor, set with setKey() or set with setNativeKey(), then attaches to
the new shared memory segment with the given access \a mode and returns
\tt true. If a shared memory segment identified by the key already exists,
the attach operation is not performed and \tt false is returned. When the
return value is \tt false, call error() to determine which error occurred.
\sa error()
*/
bool QSharedMemory::create(int size, AccessMode mode)
{
Q_D(QSharedMemory);
if (!d->initKey())
return false;
if (size <= 0) {
d->error = QSharedMemory::InvalidSize;
d->errorString = QSharedMemory::tr("%1: create size is less then 0").arg(QLatin1String("QSharedMemory::create"));
return false;
}
#ifndef QT_NO_SYSTEMSEMAPHORE
// Take ownership and force set initialValue because the semaphore
// might have already existed from a previous crash.
d->systemSemaphore.setKey(d->key, 1, QSystemSemaphore::Create);
QSharedMemoryLocker lock(this);
if (!d->key.isNull() && !d->tryLocker(&lock, QLatin1String("QSharedMemory::create")))
return false;
#endif
if (!d->create(size))
return false;
return d->attach(mode);
}
/*!
Returns the size of the attached shared memory segment. If no shared
memory segment is attached, 0 is returned.
\sa create() attach()
*/
int QSharedMemory::size() const
{
Q_D(const QSharedMemory);
return d->size;
}
/*!
\enum QSharedMemory::AccessMode
\value ReadOnly The shared memory segment is read-only. Writing to
the shared memory segment is not allowed. An attempt to write to a
shared memory segment created with ReadOnly causes the program to
abort.
\value ReadWrite Reading and writing the shared memory segment are
both allowed.
*/
/*!
Attempts to attach the process to the shared memory segment
identified by the key that was passed to the constructor or to a
call to setKey() or setNativeKey(). The access \a mode is \l {QSharedMemory::}
{ReadWrite} by default. It can also be \l {QSharedMemory::}
{ReadOnly}. Returns true if the attach operation is successful. If
false is returned, call error() to determine which error occurred.
After attaching the shared memory segment, a pointer to the shared
memory can be obtained by calling data().
\sa isAttached(), detach(), create()
*/
bool QSharedMemory::attach(AccessMode mode)
{
Q_D(QSharedMemory);
if (isAttached() || !d->initKey())
return false;
#ifndef QT_NO_SYSTEMSEMAPHORE
QSharedMemoryLocker lock(this);
if (!d->key.isNull() && !d->tryLocker(&lock, QLatin1String("QSharedMemory::attach")))
return false;
#endif
if (isAttached() || !d->handle())
return false;
return d->attach(mode);
}
/*!
Returns true if this process is attached to the shared memory
segment.
\sa attach(), detach()
*/
bool QSharedMemory::isAttached() const
{
Q_D(const QSharedMemory);
return (d->memory != nullptr);
}
/*!
Detaches the process from the shared memory segment. If this was the
last process attached to the shared memory segment, then the shared
memory segment is released by the system, i.e., the contents are
destroyed. The function returns true if it detaches the shared
memory segment. If it returns false, it usually means the segment
either isn't attached, or it is locked by another process.
\sa attach(), isAttached()
*/
bool QSharedMemory::detach()
{
Q_D(QSharedMemory);
if (!isAttached())
return false;
#ifndef QT_NO_SYSTEMSEMAPHORE
QSharedMemoryLocker lock(this);
if (!d->key.isNull() && !d->tryLocker(&lock, QLatin1String("QSharedMemory::detach")))
return false;
#endif
return d->detach();
}
/*!
Returns a pointer to the contents of the shared memory segment, if
one is attached. Otherwise it returns null. Remember to lock the
shared memory with lock() before reading from or writing to the
shared memory, and remember to release the lock with unlock() after
you are done.
\sa attach()
*/
void *QSharedMemory::data()
{
Q_D(QSharedMemory);
return d->memory;
}
/*!
Returns a const pointer to the contents of the shared memory
segment, if one is attached. Otherwise it returns null. Remember to
lock the shared memory with lock() before reading from or writing to
the shared memory, and remember to release the lock with unlock()
after you are done.
\sa attach() create()
*/
const void* QSharedMemory::constData() const
{
Q_D(const QSharedMemory);
return d->memory;
}
/*!
\overload data()
*/
const void *QSharedMemory::data() const
{
Q_D(const QSharedMemory);
return d->memory;
}
#ifndef QT_NO_SYSTEMSEMAPHORE
/*!
This is a semaphore that locks the shared memory segment for access
by this process and returns true. If another process has locked the
segment, this function blocks until the lock is released. Then it
acquires the lock and returns true. If this function returns false,
it means that you have ignored a false return from create() or attach(),
that you have set the key with setNativeKey() or that
QSystemSemaphore::acquire() failed due to an unknown system error.
\sa unlock(), data(), QSystemSemaphore::acquire()
*/
bool QSharedMemory::lock()
{
Q_D(QSharedMemory);
if (d->lockedByMe) {
qWarning("QSharedMemory::lock: already locked");
return true;
}
if (d->systemSemaphore.acquire()) {
d->lockedByMe = true;
return true;
}
d->errorString = QSharedMemory::tr("%1: unable to lock").arg(QLatin1String("QSharedMemory::lock"));
d->error = QSharedMemory::LockError;
return false;
}
/*!
Releases the lock on the shared memory segment and returns true, if
the lock is currently held by this process. If the segment is not
locked, or if the lock is held by another process, nothing happens
and false is returned.
\sa lock()
*/
bool QSharedMemory::unlock()
{
Q_D(QSharedMemory);
if (!d->lockedByMe)
return false;
d->lockedByMe = false;
if (d->systemSemaphore.release())
return true;
d->errorString = QSharedMemory::tr("%1: unable to unlock").arg(QLatin1String("QSharedMemory::unlock"));
d->error = QSharedMemory::LockError;
return false;
}
#endif // QT_NO_SYSTEMSEMAPHORE
/*!
\enum QSharedMemory::SharedMemoryError
\value NoError No error occurred.
\value PermissionDenied The operation failed because the caller
didn't have the required permissions.
\value InvalidSize A create operation failed because the requested
size was invalid.
\value KeyError The operation failed because of an invalid key.
\value AlreadyExists A create() operation failed because a shared
memory segment with the specified key already existed.
\value NotFound An attach() failed because a shared memory segment
with the specified key could not be found.
\value LockError The attempt to lock() the shared memory segment
failed because create() or attach() failed and returned false, or
because a system error occurred in QSystemSemaphore::acquire().
\value OutOfResources A create() operation failed because there was
not enough memory available to fill the request.
\value UnknownError Something else happened and it was bad.
*/
/*!
Returns a value indicating whether an error occurred, and, if so,
which error it was.
\sa errorString()
*/
QSharedMemory::SharedMemoryError QSharedMemory::error() const
{
Q_D(const QSharedMemory);
return d->error;
}
/*!
Returns a text description of the last error that occurred. If
error() returns an \l {QSharedMemory::SharedMemoryError} {error
value}, call this function to get a text string that describes the
error.
\sa error()
*/
QString QSharedMemory::errorString() const
{
Q_D(const QSharedMemory);
return d->errorString;
}
#endif // QT_NO_SHAREDMEMORY
#include "moc_qsharedmemory.h"
QT_END_NAMESPACE

View file

@ -1,96 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSHAREDMEMORY_H
#define QSHAREDMEMORY_H
#include <QtCore/qobject.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SHAREDMEMORY
class QSharedMemoryPrivate;
class Q_CORE_EXPORT QSharedMemory : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QSharedMemory)
public:
enum AccessMode {
ReadOnly,
ReadWrite
};
enum SharedMemoryError {
NoError,
PermissionDenied,
InvalidSize,
KeyError,
AlreadyExists,
NotFound,
LockError,
OutOfResources,
UnknownError
};
QSharedMemory(QObject *parent = nullptr);
QSharedMemory(const QString &key, QObject *parent = nullptr);
~QSharedMemory();
void setKey(const QString &key);
QString key() const;
void setNativeKey(const QString &key);
QString nativeKey() const;
bool create(int size, AccessMode mode = ReadWrite);
int size() const;
bool attach(AccessMode mode = ReadWrite);
bool isAttached() const;
bool detach();
void *data();
const void* constData() const;
const void *data() const;
#ifndef QT_NO_SYSTEMSEMAPHORE
bool lock();
bool unlock();
#endif
SharedMemoryError error() const;
QString errorString() const;
private:
Q_DISABLE_COPY(QSharedMemory)
};
#endif // QT_NO_SHAREDMEMORY
QT_END_NAMESPACE
#endif // QSHAREDMEMORY_H

View file

@ -1,142 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSHAREDMEMORY_P_H
#define QSHAREDMEMORY_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Katie API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qsharedmemory.h"
#ifdef QT_NO_SHAREDMEMORY
QT_BEGIN_NAMESPACE
# ifndef QT_NO_SYSTEMSEMAPHORE
namespace QSharedMemoryPrivate
{
QString makePlatformSafeKey(const QString &key,
const QString &prefix = QLatin1String("/qipc_sharedmemory_"));
}
#endif // QT_NO_SYSTEMSEMAPHORE
QT_END_NAMESPACE
#else // QT_NO_SHAREDMEMORY
#include "qsystemsemaphore.h"
#include "qobject_p.h"
#include <sys/types.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SYSTEMSEMAPHORE
/*!
Helper class
*/
class QSharedMemoryLocker
{
public:
inline QSharedMemoryLocker(QSharedMemory *sharedMemory) : q_sm(sharedMemory)
{
Q_ASSERT(q_sm);
}
inline ~QSharedMemoryLocker()
{
if (q_sm)
q_sm->unlock();
}
inline bool lock()
{
if (q_sm && q_sm->lock())
return true;
q_sm = nullptr;
return false;
}
private:
QSharedMemory *q_sm;
};
#endif // QT_NO_SYSTEMSEMAPHORE
class Q_AUTOTEST_EXPORT QSharedMemoryPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QSharedMemory)
public:
QSharedMemoryPrivate();
void *memory;
int size;
QString key;
QString nativeKey;
QSharedMemory::SharedMemoryError error;
QString errorString;
#ifndef QT_NO_SYSTEMSEMAPHORE
QSystemSemaphore systemSemaphore;
bool lockedByMe;
#endif
static QString makePlatformSafeKey(const QString &key,
const QString &prefix = QLatin1String("/qipc_sharedmemory_"));
int handle();
bool initKey();
void cleanHandle();
bool create(int size);
bool attach(QSharedMemory::AccessMode mode);
bool detach();
void setErrorString(const QString &function);
#ifndef QT_NO_SYSTEMSEMAPHORE
inline bool tryLocker(QSharedMemoryLocker *locker, const QString &function) {
if (!locker->lock()) {
errorString = QSharedMemory::tr("%1: unable to lock").arg(function);
error = QSharedMemory::LockError;
return false;
}
return true;
}
#endif // QT_NO_SYSTEMSEMAPHORE
private:
int hand;
};
QT_END_NAMESPACE
#endif // QT_NO_SHAREDMEMORY
#endif // QSHAREDMEMORY_P_H

View file

@ -1,233 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qplatformdefs.h"
#include "qsharedmemory.h"
#include "qsharedmemory_p.h"
#include "qdebug.h"
#include "qfile.h"
#ifndef QT_NO_SHAREDMEMORY
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#endif // QT_NO_SHAREDMEMORY
#include <errno.h>
#include "qcore_unix_p.h"
#ifndef QT_NO_SHAREDMEMORY
//#define QSHAREDMEMORY_DEBUG
QT_BEGIN_NAMESPACE
QSharedMemoryPrivate::QSharedMemoryPrivate()
: QObjectPrivate(), memory(0), size(0), error(QSharedMemory::NoError),
#ifndef QT_NO_SYSTEMSEMAPHORE
systemSemaphore(QString()), lockedByMe(false),
#endif
hand(0)
{
}
void QSharedMemoryPrivate::setErrorString(const QString &function)
{
// EINVAL is handled in functions so they can give better error strings
switch (errno) {
case EACCES:
case EPERM:
errorString = QSharedMemory::tr("%1: permission denied").arg(function);
error = QSharedMemory::PermissionDenied;
break;
case EEXIST:
errorString = QSharedMemory::tr("%1: already exists").arg(function);
error = QSharedMemory::AlreadyExists;
break;
case ENOENT:
errorString = QSharedMemory::tr("%1: doesn't exist").arg(function);
error = QSharedMemory::NotFound;
break;
case EAGAIN:
case EMFILE:
case ENFILE:
case ENOMEM:
case ENOSPC:
errorString = QSharedMemory::tr("%1: out of resources").arg(function);
error = QSharedMemory::OutOfResources;
break;
case EOVERFLOW:
errorString = QSharedMemory::tr("%1: invalid size").arg(function);
error = QSharedMemory::InvalidSize;
break;
default:
errorString = QSharedMemory::tr("%1: unknown error %2").arg(function).arg(errno);
error = QSharedMemory::UnknownError;
#ifdef QSHAREDMEMORY_DEBUG
qDebug() << errorString << "key" << key << "errno" << errno << EINVAL;
#endif
break;
}
}
/*!
\internal
If not already made create the handle used for accessing the shared memory.
*/
int QSharedMemoryPrivate::handle()
{
// don't allow making handles on empty keys
QString safeKey = makePlatformSafeKey(key);
if (safeKey.isEmpty()) {
errorString = QSharedMemory::tr("%1: key is empty").arg(QLatin1String("QSharedMemory::handle"));
error = QSharedMemory::KeyError;
return 0;
}
return 1;
}
void QSharedMemoryPrivate::cleanHandle()
{
qt_safe_close(hand);
hand = 0;
}
bool QSharedMemoryPrivate::create(int size)
{
if (!handle())
return false;
QByteArray shmName = QFile::encodeName(makePlatformSafeKey(key));
int fd;
Q_EINTR_LOOP(fd, ::shm_open(shmName.constData(), O_RDWR | O_CREAT | O_EXCL, 0666));
if (fd == -1) {
QString function = QLatin1String("QSharedMemory::create");
switch (errno) {
case ENAMETOOLONG:
case EINVAL:
errorString = QSharedMemory::tr("%1: bad name").arg(function);
error = QSharedMemory::KeyError;
break;
default:
setErrorString(function);
}
return false;
}
// the size may only be set once; ignore errors
int ret;
Q_EINTR_LOOP(ret, QT_FTRUNCATE(fd, size));
if (ret == -1) {
setErrorString(QLatin1String("QSharedMemory::create (ftruncate)"));
qt_safe_close(fd);
return false;
}
qt_safe_close(fd);
return true;
}
bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode)
{
QByteArray shmName = QFile::encodeName(makePlatformSafeKey(key));
int oflag = (mode == QSharedMemory::ReadOnly ? O_RDONLY : O_RDWR);
mode_t omode = (mode == QSharedMemory::ReadOnly ? 0444 : 0660);
Q_EINTR_LOOP(hand, ::shm_open(shmName.constData(), oflag, omode));
if (hand == -1) {
QString function = QLatin1String("QSharedMemory::attach (shm_open)");
switch (errno) {
case ENAMETOOLONG:
case EINVAL:
errorString = QSharedMemory::tr("%1: bad name").arg(function);
error = QSharedMemory::KeyError;
break;
default:
setErrorString(function);
}
hand = 0;
return false;
}
// grab the size
QT_STATBUF st;
if (QT_FSTAT(hand, &st) == -1) {
setErrorString(QLatin1String("QSharedMemory::attach (fstat)"));
cleanHandle();
return false;
}
size = st.st_size;
// grab the memory
int mprot = (mode == QSharedMemory::ReadOnly ? PROT_READ : PROT_READ | PROT_WRITE);
memory = QT_MMAP(nullptr, size, mprot, MAP_SHARED, hand, 0);
if (memory == MAP_FAILED || !memory) {
setErrorString(QLatin1String("QSharedMemory::attach (mmap)"));
cleanHandle();
memory = nullptr;
size = 0;
return false;
}
return true;
}
bool QSharedMemoryPrivate::detach()
{
// detach from the memory segment
if (munmap(memory, size) == -1) {
setErrorString(QLatin1String("QSharedMemory::detach (munmap)"));
return false;
}
memory = nullptr;
size = 0;
// get the number of current attachments
int shm_nattch = 0;
QT_STATBUF st;
if (QT_FSTAT(hand, &st) == 0) {
// subtract 2 from linkcount: one for our own open and one for the dir entry
shm_nattch = st.st_nlink - 2;
}
cleanHandle();
// if there are no attachments then unlink the shared memory
if (shm_nattch == 0) {
QByteArray shmName = QFile::encodeName(makePlatformSafeKey(key));
if (::shm_unlink(shmName.constData()) == -1 && errno != ENOENT)
setErrorString(QLatin1String("QSharedMemory::detach (shm_unlink)"));
}
return true;
}
QT_END_NAMESPACE
#endif // QT_NO_SHAREDMEMORY

View file

@ -1,309 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qsystemsemaphore.h"
#include "qsystemsemaphore_p.h"
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SYSTEMSEMAPHORE
/*!
\class QSystemSemaphore
\since 4.4
\brief The QSystemSemaphore class provides a general counting system semaphore.
A semaphore is a generalization of a mutex. While a mutex can be
locked only once, a semaphore can be acquired multiple times.
Typically, a semaphore is used to protect a certain number of
identical resources.
Like its lighter counterpart QSemaphore, a QSystemSemaphore can be
accessed from multiple \l {QThread} {threads}. Unlike QSemaphore, a
QSystemSemaphore can also be accessed from multiple \l {QProcess}
{processes}. This means QSystemSemaphore is a much heavier class, so
if your application doesn't need to access your semaphores across
multiple processes, you will probably want to use QSemaphore.
Semaphores support two fundamental operations, acquire() and release():
acquire() tries to acquire one resource. If there isn't a resource
available, the call blocks until a resource becomes available. Then
the resource is acquired and the call returns.
release() releases one resource so it can be acquired by another
process. The function can also be called with a parameter n > 1,
which releases n resources.
A system semaphore is created with a string key that other processes
can use to use the same semaphore.
Example: Create a system semaphore
\snippet doc/src/snippets/code/src_corelib_kernel_qsystemsemaphore.cpp 0
A typical application of system semaphores is for controlling access
to a circular buffer shared by a producer process and a consumer
processes.
\section1 Platform-Specific Behavior
When using this class, be aware of the following platform
differences:
\bold{Unix:}
\list
\o QSystemSemaphore owns the underlying system semaphore
in Unix systems. This means that the last process having an instance of
QSystemSemaphore for a particular key must remove the underlying
system semaphore in its destructor. If the last process crashes
without running the QSystemSemaphore destructor, Unix does not
automatically remove the underlying system semaphore, and the
semaphore survives the crash. A subsequent process that constructs a
QSystemSemaphore with the same key will then be given the existing
system semaphore. In that case, if the QSystemSemaphore constructor
has specified its \l {QSystemSemaphore::AccessMode} {access mode} as
\l {QSystemSemaphore::} {Open}, its initial resource count will not
be reset to the one provided but remain set to the value it received
in the crashed process. To protect against this, the first process
to create a semaphore for a particular key (usually a server), must
pass its \l {QSystemSemaphore::AccessMode} {access mode} as \l
{QSystemSemaphore::} {Create}, which will force Unix to reset the
resource count in the underlying system semaphore.
\o When a process using QSystemSemaphore terminates for
any reason, Unix automatically reverses the effect of all acquire
operations that were not released. Thus if the process acquires a
resource and then exits without releasing it, Unix will release that
resource.
\endlist
\sa QSharedMemory, QSemaphore
*/
/*!
Requests a system semaphore for the specified \a key. The parameters
\a initialValue and \a mode are used according to the following
rules, which are system dependent.
In Unix, if the \a mode is \l {QSystemSemaphore::} {Open} and the
system already has a semaphore identified by \a key, that semaphore
is used, and the semaphore's resource count is not changed, i.e., \a
initialValue is ignored. But if the system does not already have a
semaphore identified by \a key, it creates a new semaphore for that
key and sets its resource count to \a initialValue.
In Unix, if the \a mode is \l {QSystemSemaphore::} {Create} and the
system already has a semaphore identified by \a key, that semaphore
is used, and its resource count is set to \a initialValue. If the
system does not already have a semaphore identified by \a key, it
creates a new semaphore for that key and sets its resource count to
\a initialValue.
The \l {QSystemSemaphore::AccessMode} {mode} parameter is only used
in Unix systems to handle the case where a semaphore survives a
process crash. In that case, the next process to allocate a
semaphore with the same \a key will get the semaphore that survived
the crash, and unless \a mode is \l {QSystemSemaphore::} {Create},
the resource count will not be reset to \a initialValue but will
retain the initial value it had been given by the crashed process.
\sa acquire(), key()
*/
QSystemSemaphore::QSystemSemaphore(const QString &key, int initialValue, AccessMode mode)
: d(new QSystemSemaphorePrivate)
{
setKey(key, initialValue, mode);
}
/*!
The destructor destroys the QSystemSemaphore object, but the
underlying system semaphore is not removed from the system unless
this instance of QSystemSemaphore is the last one existing for that
system semaphore.
Two important side effects of the destructor depend on the system.
In Unix, acquired resources that are not released before the
destructor is called are automatically released when the process exits.
*/
QSystemSemaphore::~QSystemSemaphore()
{
d->cleanHandle();
delete d;
}
/*!
\enum QSystemSemaphore::AccessMode
This enum is used by the constructor and setKey(). Its purpose is to
enable handling the problem in Unix implementations of semaphores
that survive a crash. In Unix, when a semaphore survives a crash, we
need a way to force it to reset its resource count, when the system
reuses the semaphore.
\value Open If the semaphore already exists, its initial resource
count is not reset. If the semaphore does not already exist, it is
created and its initial resource count set.
\value Create QSystemSemaphore takes ownership of the semaphore and
sets its resource count to the requested value, regardless of
whether the semaphore already exists by having survived a crash.
This value should be passed to the constructor, when the first
semaphore for a particular key is constructed and you know that if
the semaphore already exists it could only be because of a crash.
*/
/*!
This function works the same as the constructor. It reconstructs
this QSystemSemaphore object. If the new \a key is different from
the old key, calling this function is like calling the destructor of
the semaphore with the old key, then calling the constructor to
create a new semaphore with the new \a key. The \a initialValue and
\a mode parameters are as defined for the constructor.
\sa QSystemSemaphore(), key()
*/
void QSystemSemaphore::setKey(const QString &key, int initialValue, AccessMode mode)
{
if (key == d->key && mode == Open)
return;
d->error = NoError;
d->errorString = QString();
d->cleanHandle();
d->key = key;
d->initialValue = initialValue;
// cache the file name so it doesn't have to be generated all the time.
d->fileName = d->makeKeyFileName();
d->handle(mode);
}
/*!
Returns the key assigned to this system semaphore. The key is the
name by which the semaphore can be accessed from other processes.
\sa setKey()
*/
QString QSystemSemaphore::key() const
{
return d->key;
}
/*!
Acquires one of the resources guarded by this semaphore, if there is
one available, and returns true. If all the resources guarded by this
semaphore have already been acquired, the call blocks until one of
them is released by another process or thread having a semaphore
with the same key.
If false is returned, a system error has occurred. Call error()
to get a value of QSystemSemaphore::SystemSemaphoreError that
indicates which error occurred.
\sa release()
*/
bool QSystemSemaphore::acquire()
{
return d->modifySemaphore(-1);
}
/*!
Releases \a n resources guarded by the semaphore. Returns true
unless there is a system error.
Example: Create a system semaphore having five resources; acquire
them all and then release them all.
\snippet doc/src/snippets/code/src_corelib_kernel_qsystemsemaphore.cpp 1
This function can also "create" resources. For example, immediately
following the sequence of statements above, suppose we add the
statement:
\snippet doc/src/snippets/code/src_corelib_kernel_qsystemsemaphore.cpp 2
Ten new resources are now guarded by the semaphore, in addition to
the five that already existed. You would not normally use this
function to create more resources.
\sa acquire()
*/
bool QSystemSemaphore::release(int n)
{
if (n == 0)
return true;
if (Q_UNLIKELY(n < 0)) {
qWarning("QSystemSemaphore::release: n is negative.");
return false;
}
return d->modifySemaphore(n);
}
/*!
Returns a value indicating whether an error occurred, and, if so,
which error it was.
\sa errorString()
*/
QSystemSemaphore::SystemSemaphoreError QSystemSemaphore::error() const
{
return d->error;
}
/*!
\enum QSystemSemaphore::SystemSemaphoreError
\value NoError No error occurred.
\value PermissionDenied The operation failed because the caller
didn't have the required permissions.
\value KeyError The operation failed because of an invalid key.
\value AlreadyExists The operation failed because a system
semaphore with the specified key already existed.
\value NotFound The operation failed because a system semaphore
with the specified key could not be found.
\value OutOfResources The operation failed because there was
not enough memory available to fill the request.
\value UnknownError Something else happened and it was bad.
*/
/*!
Returns a text description of the last error that occurred. If
error() returns an \l {QSystemSemaphore::SystemSemaphoreError} {error
value}, call this function to get a text string that describes the
error.
\sa error()
*/
QString QSystemSemaphore::errorString() const
{
return d->errorString;
}
#endif // QT_NO_SYSTEMSEMAPHORE
QT_END_NAMESPACE

View file

@ -1,79 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSYSTEMSEMAPHORE_H
#define QSYSTEMSEMAPHORE_H
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_SYSTEMSEMAPHORE
class QSystemSemaphorePrivate;
class Q_CORE_EXPORT QSystemSemaphore
{
public:
enum AccessMode
{
Open,
Create
};
enum SystemSemaphoreError
{
NoError,
PermissionDenied,
KeyError,
AlreadyExists,
NotFound,
OutOfResources,
UnknownError
};
QSystemSemaphore(const QString &key, int initialValue = 0, AccessMode mode = Open);
~QSystemSemaphore();
void setKey(const QString &key, int initialValue = 0, AccessMode mode = Open);
QString key() const;
bool acquire();
bool release(int n = 1);
SystemSemaphoreError error() const;
QString errorString() const;
private:
Q_DISABLE_COPY(QSystemSemaphore)
QSystemSemaphorePrivate* d;
};
#endif // QT_NO_SYSTEMSEMAPHORE
QT_END_NAMESPACE
#endif // QSYSTEMSEMAPHORE_H

View file

@ -1,75 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QSYSTEMSEMAPHORE_P_H
#define QSYSTEMSEMAPHORE_P_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Katie API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include "qsystemsemaphore.h"
#ifndef QT_NO_SYSTEMSEMAPHORE
#include "qsharedmemory_p.h"
#include <sys/types.h>
#include <semaphore.h>
QT_BEGIN_NAMESPACE
class QSystemSemaphorePrivate
{
public:
QSystemSemaphorePrivate();
inline QString makeKeyFileName() const
{
return QSharedMemoryPrivate::makePlatformSafeKey(key, QLatin1String("/qipc_systemsem_"));
}
bool handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open);
void setErrorString(const QString &function);
void cleanHandle();
bool modifySemaphore(int count);
QString key;
QString fileName;
int initialValue;
sem_t *semaphore;
bool createdSemaphore;
QString errorString;
QSystemSemaphore::SystemSemaphoreError error;
};
QT_END_NAMESPACE
#endif // QT_NO_SYSTEMSEMAPHORE
#endif // QSYSTEMSEMAPHORE_P_H

View file

@ -1,231 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2016 Ivailo Monev
**
** This file is part of the QtCore module of the Katie Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
**
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qsystemsemaphore.h"
#include "qsystemsemaphore_p.h"
#include "qcoreapplication.h"
#include "qdebug.h"
#include "qfile.h"
#ifndef QT_NO_SYSTEMSEMAPHORE
#include <sys/types.h>
#include <sys/ipc.h>
#include <fcntl.h>
#include <errno.h>
#include "qcore_unix_p.h"
// OpenBSD 4.2 doesn't define EIDRM, see BUGS section:
// https://man.openbsd.org/OpenBSD-4.2/semop.2
#if defined(Q_OS_OPENBSD) && !defined(EIDRM)
#define EIDRM EINVAL
#endif
// Hurd has SEM_FAILED defined as void pointer which triggers invalid
// type conversion compiler error
#if defined(Q_OS_HURD)
# define QT_SEM_FAILED static_cast<sem_t*>(SEM_FAILED)
#else
# define QT_SEM_FAILED SEM_FAILED
#endif
//#define QSYSTEMSEMAPHORE_DEBUG
QT_BEGIN_NAMESPACE
QSystemSemaphorePrivate::QSystemSemaphorePrivate()
: initialValue(0),
semaphore(QT_SEM_FAILED),
createdSemaphore(false),
error(QSystemSemaphore::NoError)
{
}
void QSystemSemaphorePrivate::setErrorString(const QString &function)
{
// EINVAL is handled in functions so they can give better error strings
switch (errno) {
case EPERM:
case EACCES:
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: permission denied").arg(function);
error = QSystemSemaphore::PermissionDenied;
break;
case EEXIST:
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: already exists").arg(function);
error = QSystemSemaphore::AlreadyExists;
break;
case ENOENT:
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: does not exist").arg(function);
error = QSystemSemaphore::NotFound;
break;
case ERANGE:
case ENOMEM:
case ENOSPC:
case EMFILE:
case ENFILE:
case EOVERFLOW:
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: out of resources").arg(function);
error = QSystemSemaphore::OutOfResources;
break;
case ENAMETOOLONG:
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: name error").arg(function);
error = QSystemSemaphore::KeyError;
break;
default:
errorString = QCoreApplication::translate("QSystemSemaphore", "%1: unknown error %2").arg(function).arg(errno);
error = QSystemSemaphore::UnknownError;
#ifdef QSYSTEMSEMAPHORE_DEBUG
qDebug() << errorString << "key" << key << "errno" << errno << EINVAL;
#endif
break;
}
}
/*!
\internal
Initialise the semaphore
*/
bool QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode)
{
if (semaphore != QT_SEM_FAILED)
return true; // we already have a semaphore
if (fileName.isEmpty()) {
errorString = QCoreApplication::tr("%1: key is empty").arg(QLatin1String("QSystemSemaphore::handle"));
error = QSystemSemaphore::KeyError;
return false;
}
QByteArray semName = QFile::encodeName(fileName);
// Always try with O_EXCL so we know whether we created the semaphore.
int oflag = O_CREAT | O_EXCL;
for (int tryNum = 0, maxTries = 1; tryNum < maxTries; ++tryNum) {
do {
semaphore = ::sem_open(semName.constData(), oflag, 0666, initialValue);
} while (semaphore == QT_SEM_FAILED && errno == EINTR);
if (semaphore == QT_SEM_FAILED && errno == EEXIST) {
if (mode == QSystemSemaphore::Create) {
if (::sem_unlink(semName.constData()) == -1 && errno != ENOENT) {
setErrorString(QLatin1String("QSystemSemaphore::handle (sem_unlink)"));
return false;
}
// Race condition: the semaphore might be recreated before
// we call sem_open again, so we'll retry several times.
maxTries = 3;
} else {
// Race condition: if it no longer exists at the next sem_open
// call, we won't realize we created it, so we'll leak it later.
oflag &= ~O_EXCL;
maxTries = 2;
}
} else {
break;
}
}
if (semaphore == QT_SEM_FAILED) {
setErrorString(QLatin1String("QSystemSemaphore::handle"));
return false;
}
createdSemaphore = (oflag & O_EXCL) != 0;
return true;
}
/*!
\internal
Clean up the semaphore
*/
void QSystemSemaphorePrivate::cleanHandle()
{
if (semaphore != QT_SEM_FAILED) {
if (::sem_close(semaphore) == -1) {
setErrorString(QLatin1String("QSystemSemaphore::cleanHandle (sem_close)"));
#ifdef QSYSTEMSEMAPHORE_DEBUG
qDebug() << QLatin1String("QSystemSemaphore::cleanHandle sem_close failed.");
#endif
}
semaphore = QT_SEM_FAILED;
}
if (createdSemaphore) {
if (::sem_unlink(QFile::encodeName(fileName).constData()) == -1 && errno != ENOENT) {
setErrorString(QLatin1String("QSystemSemaphore::cleanHandle (sem_unlink)"));
#ifdef QSYSTEMSEMAPHORE_DEBUG
qDebug() << QLatin1String("QSystemSemaphore::cleanHandle sem_unlink failed.");
#endif
}
createdSemaphore = false;
}
}
/*!
\internal
*/
bool QSystemSemaphorePrivate::modifySemaphore(int count)
{
if (!handle())
return false;
if (count > 0) {
int cnt = count;
do {
if (::sem_post(semaphore) == -1) {
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore (sem_post)"));
#ifdef QSYSTEMSEMAPHORE_DEBUG
qDebug() << QLatin1String("QSystemSemaphore::modify sem_post failed") << count << errno;
#endif
// rollback changes to preserve the SysV semaphore behavior
for ( ; cnt < count; ++cnt) {
int res;
Q_EINTR_LOOP(res, ::sem_wait(semaphore));
}
return false;
}
--cnt;
} while (cnt > 0);
} else {
int res;
Q_EINTR_LOOP(res, ::sem_wait(semaphore));
if (res == -1) {
// If the semaphore was removed be nice and create it and then modifySemaphore again
if (errno == EINVAL || errno == EIDRM) {
semaphore = QT_SEM_FAILED;
return modifySemaphore(count);
}
setErrorString(QLatin1String("QSystemSemaphore::modifySemaphore (sem_wait)"));
#ifdef QSYSTEMSEMAPHORE_DEBUG
qDebug() << QLatin1String("QSystemSemaphore::modify sem_wait failed") << count << errno;
#endif
return false;
}
}
return true;
}
QT_END_NAMESPACE
#endif // QT_NO_SYSTEMSEMAPHORE

View file

@ -458,7 +458,6 @@ static const struct ClassTblData {
{ QLatin1String("QSet"), QLatin1String("QtCore/qset.h") },
{ QLatin1String("QSettings"), QLatin1String("QtCore/qsettings.h") },
{ QLatin1String("QSharedData"), QLatin1String("QtCore/qshareddata.h") },
{ QLatin1String("QSharedMemory"), QLatin1String("QtCore/qsharedmemory.h") },
{ QLatin1String("QSharedPointer"), QLatin1String("QtCore/qsharedpointer.h") },
{ QLatin1String("QShortcut"), QLatin1String("QtGui/qshortcut.h") },
{ QLatin1String("QShortcutEvent"), QLatin1String("QtGui/qevent.h") },
@ -525,7 +524,6 @@ static const struct ClassTblData {
{ QLatin1String("QStyledItemDelegate"), QLatin1String("QtGui/qstyleditemdelegate.h") },
{ QLatin1String("QSvgRenderer"), QLatin1String("QtSvg/qsvgrenderer.h") },
{ QLatin1String("QSyntaxHighlighter"), QLatin1String("QtGui/qsyntaxhighlighter.h") },
{ QLatin1String("QSystemSemaphore"), QLatin1String("QtCore/qsystemsemaphore.h") },
{ QLatin1String("QSystemTrayIcon"), QLatin1String("QtGui/qsystemtrayicon.h") },
{ QLatin1String("QTabBar"), QLatin1String("QtGui/qtabbar.h") },
{ QLatin1String("QTabWidget"), QLatin1String("QtGui/qtabwidget.h") },

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-23 23:10+0200\n"
"POT-Creation-Date: 2022-02-28 17:03+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,32 +17,32 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/core/plugin/qlibrary.cpp:176
#: src/core/plugin/qlibrary.cpp:175
msgid "'%1' is not ELF file"
msgstr ""
#: src/core/plugin/qlibrary.cpp:179
#: src/core/plugin/qlibrary.cpp:178
msgid "ELF class mismatch in '%1'"
msgstr ""
#: src/core/plugin/qlibrary.cpp:203
#: src/core/plugin/qlibrary.cpp:202
msgid "Plugin verification data mismatch in '%1'"
msgstr ""
#: src/core/plugin/qlibrary.cpp:418 src/core/plugin/qlibrary.cpp:453
#: src/core/plugin/qlibrary.cpp:417 src/core/plugin/qlibrary.cpp:452
#: src/core/plugin/qpluginloader.cpp:261
msgid "The shared library was not found."
msgstr ""
#: src/core/plugin/qlibrary.cpp:455
#: src/core/plugin/qlibrary.cpp:454
msgid "The file '%1' is not a valid Katie plugin."
msgstr ""
#: src/core/plugin/qlibrary.cpp:467
#: src/core/plugin/qlibrary.cpp:466
msgid "The plugin uses incompatible Katie library: %1 (%2, %3)"
msgstr ""
#: src/core/plugin/qlibrary.cpp:799 src/core/plugin/qpluginloader.cpp:278
#: src/core/plugin/qlibrary.cpp:798 src/core/plugin/qpluginloader.cpp:278
#: src/core/io/qiodevice.cpp:1517
#: src/network/socket/qabstractsocketengine.cpp:439
#: src/uitools/formscriptrunner.cpp:104
@ -176,86 +176,6 @@ msgstr ""
msgid "Process operation timed out"
msgstr ""
#: src/core/kernel/qsharedmemory.cpp:208
msgid "%1: unable to set key on lock"
msgstr ""
#: src/core/kernel/qsharedmemory.cpp:292
msgid "%1: create size is less then 0"
msgstr ""
#: src/core/kernel/qsharedmemory.cpp:465 src/core/kernel/qsharedmemory_p.h:119
msgid "%1: unable to lock"
msgstr ""
#: src/core/kernel/qsharedmemory.cpp:486
msgid "%1: unable to unlock"
msgstr ""
#: src/core/kernel/qsharedmemory_unix.cpp:63
msgid "%1: permission denied"
msgstr ""
#: src/core/kernel/qsharedmemory_unix.cpp:67
msgid "%1: already exists"
msgstr ""
#: src/core/kernel/qsharedmemory_unix.cpp:71
msgid "%1: doesn't exist"
msgstr ""
#: src/core/kernel/qsharedmemory_unix.cpp:79
msgid "%1: out of resources"
msgstr ""
#: src/core/kernel/qsharedmemory_unix.cpp:83
msgid "%1: invalid size"
msgstr ""
#: src/core/kernel/qsharedmemory_unix.cpp:87
msgid "%1: unknown error %2"
msgstr ""
#: src/core/kernel/qsharedmemory_unix.cpp:106
#: src/core/kernel/qsystemsemaphore_unix.cpp:115
msgid "%1: key is empty"
msgstr ""
#: src/core/kernel/qsharedmemory_unix.cpp:134
#: src/core/kernel/qsharedmemory_unix.cpp:170
msgid "%1: bad name"
msgstr ""
#: src/core/kernel/qsystemsemaphore_unix.cpp:70
msgctxt "QSystemSemaphore"
msgid "%1: permission denied"
msgstr ""
#: src/core/kernel/qsystemsemaphore_unix.cpp:74
msgctxt "QSystemSemaphore"
msgid "%1: already exists"
msgstr ""
#: src/core/kernel/qsystemsemaphore_unix.cpp:78
msgctxt "QSystemSemaphore"
msgid "%1: does not exist"
msgstr ""
#: src/core/kernel/qsystemsemaphore_unix.cpp:87
msgctxt "QSystemSemaphore"
msgid "%1: out of resources"
msgstr ""
#: src/core/kernel/qsystemsemaphore_unix.cpp:91
msgctxt "QSystemSemaphore"
msgid "%1: name error"
msgstr ""
#: src/core/kernel/qsystemsemaphore_unix.cpp:95
msgctxt "QSystemSemaphore"
msgid "%1: unknown error %2"
msgstr ""
#: src/core/tools/qregexp.cpp:45
msgctxt "QRegExp"
msgid "no error occurred"
@ -1448,143 +1368,143 @@ msgstr ""
msgid "Incompatible Katie Library Error"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:52
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:51
msgid "A0"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:53
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:52
msgid "A1"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:54
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:53
msgid "A2"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:55
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:54
msgid "A3"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:56
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:55
msgid "A4"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:57
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:56
msgid "A5"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:58
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:57
msgid "A6"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:59
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:58
msgid "A7"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:60
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:59
msgid "A8"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:61
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:60
msgid "A9"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:62
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:61
msgid "B0"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:63
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:62
msgid "B1"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:64
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:63
msgid "B2"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:65
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:64
msgid "B3"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:66
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:65
msgid "B4"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:67
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:66
msgid "B5"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:68
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:67
msgid "B6"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:69
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:68
msgid "B7"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:70
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:69
msgid "B8"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:71
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:70
msgid "B9"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:72
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:71
msgid "B10"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:73
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:72
msgid "C5E"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:74
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:73
msgid "DLE"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:75
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:74
msgid "Executive"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:76
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:75
msgid "Folio"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:77
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:76
msgid "Ledger"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:78
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:77
msgid "Legal"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:79
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:78
msgid "Letter"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:80
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:79
msgid "Tabloid"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:81
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:80
msgid "US Common #10 Envelope"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:82
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:81
msgid "Custom"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:269
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:268
msgid "Centimeters (cm)"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:269
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:268
msgid "Millimeters (mm)"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:269
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:268
msgid "Inches (in)"
msgstr ""
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:269
#: src/gui/dialogs/qpagesetupdialog_unix.cpp:268
msgid "Points (pt)"
msgstr ""
@ -1758,53 +1678,53 @@ msgstr ""
msgid "Recent Places"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:644
#: src/gui/dialogs/qfilesystemmodel.cpp:640
#: src/gui/itemviews/qdirmodel.cpp:1204
msgid "%1 TB"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:646
#: src/gui/dialogs/qfilesystemmodel.cpp:642
#: src/gui/itemviews/qdirmodel.cpp:1206
msgid "%1 GB"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:648
#: src/gui/dialogs/qfilesystemmodel.cpp:644
#: src/gui/itemviews/qdirmodel.cpp:1208
msgid "%1 MB"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:650
#: src/gui/dialogs/qfilesystemmodel.cpp:646
#: src/gui/itemviews/qdirmodel.cpp:1210
msgid "%1 KB"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:651
#: src/gui/dialogs/qfilesystemmodel.cpp:647
msgid "%1 bytes"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:721
#: src/gui/dialogs/qfilesystemmodel.cpp:717
msgid "Invalid filename"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:722
#: src/gui/dialogs/qfilesystemmodel.cpp:718
msgid ""
"<b>The name \"%1\" can not be used.</b><p>Try using another name, with fewer "
"characters or no punctuations marks."
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:790 src/gui/itemviews/qdirmodel.cpp:395
#: src/gui/dialogs/qfilesystemmodel.cpp:786 src/gui/itemviews/qdirmodel.cpp:395
msgid "Name"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:794 src/gui/itemviews/qdirmodel.cpp:396
#: src/gui/dialogs/qfilesystemmodel.cpp:790 src/gui/itemviews/qdirmodel.cpp:396
msgid "Size"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:798 src/gui/itemviews/qdirmodel.cpp:397
#: src/gui/dialogs/qfilesystemmodel.cpp:794 src/gui/itemviews/qdirmodel.cpp:397
msgid "Type"
msgstr ""
#: src/gui/dialogs/qfilesystemmodel.cpp:804 src/gui/itemviews/qdirmodel.cpp:400
#: src/gui/dialogs/qfilesystemmodel.cpp:800 src/gui/itemviews/qdirmodel.cpp:400
msgid "Date Modified"
msgstr ""
@ -1828,27 +1748,27 @@ msgstr ""
msgid "&OK"
msgstr ""
#: src/gui/image/qimagereader.cpp:299
#: src/gui/image/qimagereader.cpp:302
msgctxt "QImageReader"
msgid "Invalid device"
msgstr ""
#: src/gui/image/qimagereader.cpp:305
#: src/gui/image/qimagereader.cpp:308
msgctxt "QImageReader"
msgid "File not found"
msgstr ""
#: src/gui/image/qimagereader.cpp:312
#: src/gui/image/qimagereader.cpp:315
msgctxt "QImageReader"
msgid "Unsupported image format"
msgstr ""
#: src/gui/image/qimagereader.cpp:804
#: src/gui/image/qimagereader.cpp:692
msgctxt "QImageReader"
msgid "Unable to read image data"
msgstr ""
#: src/gui/image/qimagereader.cpp:995
#: src/gui/image/qimagereader.cpp:820
msgctxt "QImageReader"
msgid "Unknown error"
msgstr ""
@ -4594,26 +4514,26 @@ msgctxt "QHostInfo"
msgid "No host name given"
msgstr ""
#: src/network/kernel/qhostinfo_unix.cpp:86
#: src/network/kernel/qhostinfo_unix.cpp:170
#: src/network/socket/qabstractsocket.cpp:691
#: src/network/kernel/qhostinfo_unix.cpp:87
#: src/network/kernel/qhostinfo_unix.cpp:171
#: src/network/socket/qabstractsocket.cpp:690
msgid "Host not found"
msgstr ""
#: src/network/kernel/qhostinfo_unix.cpp:104
#: src/network/kernel/qhostinfo_unix.cpp:105
msgid "No host name given"
msgstr ""
#: src/network/kernel/qhostinfo_unix.cpp:106
#: src/network/kernel/qhostinfo_unix.cpp:107
msgid "Invalid hostname"
msgstr ""
#: src/network/kernel/qhostinfo_unix.cpp:158
#: src/network/kernel/qhostinfo_unix.cpp:159
msgid "Unknown address type"
msgstr ""
#: src/network/socket/qtcpserver.cpp:216
#: src/network/socket/qabstractsocket.cpp:430
#: src/network/socket/qabstractsocket.cpp:429
msgid "Operation on socket is not supported"
msgstr ""
@ -4635,21 +4555,21 @@ msgstr ""
msgid "%1: Unknown error %2"
msgstr ""
#: src/network/socket/qabstractsocket.cpp:733
#: src/network/socket/qabstractsocket.cpp:732
#: src/network/socket/qabstractsocketengine.cpp:406
msgid "Connection refused"
msgstr ""
#: src/network/socket/qabstractsocket.cpp:871
#: src/network/socket/qabstractsocket.cpp:870
#: src/network/socket/qabstractsocketengine.cpp:403
msgid "Connection timed out"
msgstr ""
#: src/network/socket/qabstractsocket.cpp:1477
#: src/network/socket/qabstractsocket.cpp:1476
msgid "Socket operation timed out"
msgstr ""
#: src/network/socket/qabstractsocket.cpp:1887
#: src/network/socket/qabstractsocket.cpp:1886
msgid "Socket is not connected"
msgstr ""
@ -4781,20 +4701,20 @@ msgstr ""
msgid "This platform does not support IPv6"
msgstr ""
#: src/scripttools/debugging/qscriptedit.cpp:391
#: src/scripttools/debugging/qscriptedit.cpp:383
#: src/scripttools/debugging/qscriptdebugger.cpp:1767
msgid "Toggle Breakpoint"
msgstr ""
#: src/scripttools/debugging/qscriptedit.cpp:393
#: src/scripttools/debugging/qscriptedit.cpp:385
msgid "Disable Breakpoint"
msgstr ""
#: src/scripttools/debugging/qscriptedit.cpp:394
#: src/scripttools/debugging/qscriptedit.cpp:386
msgid "Enable Breakpoint"
msgstr ""
#: src/scripttools/debugging/qscriptedit.cpp:398
#: src/scripttools/debugging/qscriptedit.cpp:390
msgid "Breakpoint Condition:"
msgstr ""

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-02-23 23:10+0200\n"
"POT-Creation-Date: 2022-02-28 17:03+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -64,59 +64,59 @@ msgid ""
"will disable the Global Strut feature.</p>"
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:161
#: src/tools/qtconfig/mainwindow.cpp:160
msgid "Desktop Settings (Default)"
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:167
#: src/tools/qtconfig/mainwindow.cpp:166
msgid "Choose style and palette based on your desktop settings."
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:182
#: src/tools/qtconfig/mainwindow.cpp:181
msgid "Unknown"
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:310
#: src/tools/qtconfig/mainwindow.cpp:315
msgid "No changes to be saved."
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:314
#: src/tools/qtconfig/mainwindow.cpp:321
msgid "Saving changes..."
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:390
#: src/tools/qtconfig/mainwindow.cpp:399
msgid "Saved changes."
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:510
#: src/tools/qtconfig/mainwindow.cpp:520
msgid ""
"<h3>%1</h3><br/>Version %2<br/><br/>Copyright (C) 2015 The Qt Company Ltd."
"<br/><br/>Copyright (C) 2016 Ivailo Monev"
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:515 src/tools/qtconfig/mainwindow.cpp:516
#: src/tools/qtconfig/mainwindow.cpp:523
#: src/tools/qtconfig/mainwindow.cpp:525 src/tools/qtconfig/mainwindow.cpp:526
#: src/tools/qtconfig/mainwindow.cpp:533
msgid "Katie Configuration"
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:546
#: src/tools/qtconfig/mainwindow.cpp:556
msgid "Save Changes"
msgstr ""
#: src/tools/qtconfig/mainwindow.cpp:547
#: src/tools/qtconfig/mainwindow.cpp:557
msgid "Save changes to settings?"
msgstr ""
#: src/tools/qtconfig/paletteeditoradvanced.cpp:34
#: src/tools/qtconfig/paletteeditoradvanced.cpp:40
#: src/tools/qtconfig/paletteeditoradvanced.cpp:42
msgid "Choose a color"
msgstr ""
#: src/tools/qtconfig/paletteeditoradvanced.cpp:35
#: src/tools/qtconfig/paletteeditoradvanced.cpp:36
msgid "Choose a color for the selected central color role."
msgstr ""
#: src/tools/qtconfig/paletteeditoradvanced.cpp:41
#: src/tools/qtconfig/paletteeditoradvanced.cpp:44
msgid "Choose a color for the selected effect color role."
msgstr ""
@ -139,7 +139,7 @@ msgid "&File"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewermain.cpp:62
#: src/tools/designer/qdesigner_actions.cpp:164
#: src/tools/designer/qdesigner_actions.cpp:165
msgid "&Quit"
msgstr ""
@ -164,56 +164,56 @@ msgstr ""
msgid "&Refresh"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:190
#: src/tools/qdbusviewer/qdbusviewer.cpp:194
msgid "Arguments"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:191
#: src/tools/qdbusviewer/qdbusviewer.cpp:195
msgid "Please enter the value of the property %1 (type %2)"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:199
#: src/tools/qdbusviewer/qdbusviewer.cpp:203
msgid "Unable to marshall"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:200
#: src/tools/qdbusviewer/qdbusviewer.cpp:204
msgid "Value conversion failed, unable to set property"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:237
#: src/tools/qdbusviewer/qdbusviewer.cpp:241
msgid "Unable to find method"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:238
#: src/tools/qdbusviewer/qdbusviewer.cpp:242
msgid "Unable to find method %1 on path %2 in interface %3"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:260
#: src/tools/qdbusviewer/qdbusviewer.cpp:264
msgid "Please enter parameters for the method \"%1\""
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:310
#: src/tools/qdbusviewer/qdbusviewer.cpp:314
msgid "&Connect"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:315
#: src/tools/qdbusviewer/qdbusviewer.cpp:319
msgid "&Call"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:320
#: src/tools/qdbusviewer/qdbusviewer.cpp:324
msgid "&Set value"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:322
#: src/tools/qdbusviewer/qdbusviewer.cpp:326
msgid "&Get value"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:355
#: src/tools/qdbusviewer/qdbusviewer.cpp:359
msgid "Unable to connect to service %1, path %2, interface %3, signal %4"
msgstr ""
#: src/tools/qdbusviewer/qdbusviewer.cpp:477
#: src/tools/qdbusviewer/qdbusviewer.cpp:478
#: src/tools/qdbusviewer/qdbusviewer.cpp:481
#: src/tools/qdbusviewer/qdbusviewer.cpp:482
msgid "D-Bus Viewer"
msgstr ""
@ -243,8 +243,8 @@ msgid "%1 - %2[*]"
msgstr ""
#: src/tools/designer/qdesigner_formwindow.cpp:207
#: src/tools/designer/qdesigner_actions.cpp:801
#: src/tools/designer/qdesigner_actions.cpp:841
#: src/tools/designer/qdesigner_actions.cpp:802
#: src/tools/designer/qdesigner_actions.cpp:842
msgid "Save Form?"
msgstr ""
@ -285,226 +285,226 @@ msgid "&Open..."
msgstr ""
#: src/tools/designer/newform.cpp:94
#: src/tools/designer/qdesigner_actions.cpp:458
#: src/tools/designer/qdesigner_actions.cpp:459
msgid "&Recent Forms"
msgstr ""
#: src/tools/designer/newform.cpp:158
#: src/tools/designer/qdesigner_actions.cpp:719
#: src/tools/designer/qdesigner_actions.cpp:720
msgid "Read error"
msgstr ""
#: src/tools/designer/newform.cpp:181
#: src/tools/designer/newform.cpp:182
msgid "A temporary form file could not be created in %1."
msgstr ""
#: src/tools/designer/newform.cpp:187
#: src/tools/designer/newform.cpp:188
msgid "The temporary form file %1 could not be written."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:104
#: src/tools/designer/qdesigner_actions.cpp:105
msgid "Saved %1."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:130
#: src/tools/designer/qdesigner_actions.cpp:131
msgid ""
"%1 already exists.\n"
"Do you want to replace it?"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:154
#: src/tools/designer/qdesigner_actions.cpp:155
msgid "Edit Widgets"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:155
#: src/tools/designer/qdesigner_actions.cpp:156
msgid "&New..."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:156
#: src/tools/designer/qdesigner_actions.cpp:157
msgid "&Open..."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:157
#: src/tools/designer/qdesigner_actions.cpp:158
msgid "&Save"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:158
#: src/tools/designer/qdesigner_actions.cpp:159
msgid "Save &As..."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:159
#: src/tools/designer/qdesigner_actions.cpp:160
msgid "Save A&ll"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:160
#: src/tools/designer/qdesigner_actions.cpp:161
msgid "Save As &Template..."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:161
#: src/tools/designer/qdesigner_actions.cpp:1000
#: src/tools/designer/qdesigner_actions.cpp:162
#: src/tools/designer/qdesigner_actions.cpp:1001
msgid "&Close"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:162
#: src/tools/designer/qdesigner_actions.cpp:163
msgid "Save &Image..."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:163
#: src/tools/designer/qdesigner_actions.cpp:164
msgid "&Print..."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:166
#: src/tools/designer/qdesigner_actions.cpp:167
msgid "View &Code..."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:167
#: src/tools/designer/qdesigner_actions.cpp:168
msgid "&Minimize"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:169
#: src/tools/designer/qdesigner_actions.cpp:170
msgid "Bring All to Front"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:171
#: src/tools/designer/qdesigner_actions.cpp:172
msgid "Preferences..."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:242
#: src/tools/designer/qdesigner_actions.cpp:243
msgid "CTRL+SHIFT+S"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:360
#: src/tools/designer/qdesigner_actions.cpp:361
msgid "CTRL+R"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:378
#: src/tools/designer/qdesigner_actions.cpp:379
msgid "CTRL+M"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:404
#: src/tools/designer/qdesigner_actions.cpp:405
msgid "About Plugins"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:410
#: src/tools/designer/qdesigner_actions.cpp:981
#: src/tools/designer/qdesigner_actions.cpp:411
#: src/tools/designer/qdesigner_actions.cpp:982
msgid "About Katie Designer"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:416
#: src/tools/designer/qdesigner_actions.cpp:417
msgid "About Katie"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:452
#: src/tools/designer/qdesigner_actions.cpp:453
msgid "Clear &Menu"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:535
#: src/tools/designer/qdesigner_actions.cpp:732
#: src/tools/designer/qdesigner_actions.cpp:536
#: src/tools/designer/qdesigner_actions.cpp:733
msgid "Open Form"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:536
#: src/tools/designer/qdesigner_actions.cpp:573
#: src/tools/designer/qdesigner_actions.cpp:733
#: src/tools/designer/qdesigner_actions.cpp:537
#: src/tools/designer/qdesigner_actions.cpp:574
#: src/tools/designer/qdesigner_actions.cpp:734
msgid "Designer UI files (*.%1);;All Files (*)"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:573
#: src/tools/designer/qdesigner_actions.cpp:821
#: src/tools/designer/qdesigner_actions.cpp:574
#: src/tools/designer/qdesigner_actions.cpp:822
msgid "Save Form As"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:660
#: src/tools/designer/qdesigner_actions.cpp:661
msgid "Designer"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:660
#: src/tools/designer/qdesigner_actions.cpp:661
msgid "Feature not implemented yet!"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:675
#: src/tools/designer/qdesigner_actions.cpp:676
msgid "Code generation failed"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:720
#: src/tools/designer/qdesigner_actions.cpp:721
msgid ""
"%1\n"
"Do you want to update the file location or generate a new form?"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:723
#: src/tools/designer/qdesigner_actions.cpp:724
msgid "&Update"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:724
#: src/tools/designer/qdesigner_actions.cpp:725
msgid "&New Form"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:802
#: src/tools/designer/qdesigner_actions.cpp:803
msgid "Could not open file"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:806
#: src/tools/designer/qdesigner_actions.cpp:807
msgid ""
"The file %1 could not be opened.\n"
"Reason: %2\n"
"Would you like to retry or select a different file?"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:812
#: src/tools/designer/qdesigner_actions.cpp:813
msgid "Select New File"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:842
#: src/tools/designer/qdesigner_actions.cpp:843
msgid "Could not write file"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:845
#: src/tools/designer/qdesigner_actions.cpp:846
msgid ""
"It was not possible to write the entire file %1 to disk.\n"
"Reason:%2\n"
"Would you like to retry?"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:998
#: src/tools/designer/qdesigner_actions.cpp:999
msgid "&Close Preview"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1039
#: src/tools/designer/qdesigner_actions.cpp:1062
#: src/tools/designer/qdesigner_actions.cpp:1040
#: src/tools/designer/qdesigner_actions.cpp:1063
msgid "The backup file %1 could not be written."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1169
#: src/tools/designer/qdesigner_actions.cpp:1170
msgid "The backup directory %1 could not be created."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1175
#: src/tools/designer/qdesigner_actions.cpp:1176
msgid "The temporary backup directory %1 could not be created."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1197
#: src/tools/designer/qdesigner_actions.cpp:1198
msgid "Preview failed"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1221
#: src/tools/designer/qdesigner_actions.cpp:1220
msgid "Image files (*.%1)"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1230
#: src/tools/designer/qdesigner_actions.cpp:1247
#: src/tools/designer/qdesigner_actions.cpp:1229
#: src/tools/designer/qdesigner_actions.cpp:1246
msgid "Save Image"
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1243
#: src/tools/designer/qdesigner_actions.cpp:1242
msgid "Saved image %1."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1248
#: src/tools/designer/qdesigner_actions.cpp:1247
msgid "The file %1 could not be written."
msgstr ""
#: src/tools/designer/qdesigner_actions.cpp:1301
#: src/tools/designer/qdesigner_actions.cpp:1300
msgid "Printed %1."
msgstr ""