Compare commits

..

9 Commits

Author SHA1 Message Date
Laurent Trinques
264392cd0e Update SingleApplication to upstream master 2021-03-02 14:06:19 +01:00
Laurent Trinques
f53e429771 Upgrade pugixml XML parser to 1.11 release
https://pugixml.org/docs/manual.html#v1.11
2021-03-02 14:05:29 +01:00
joshua
a6e55e1918 Fix wrong element type 2021-02-24 20:51:33 +01:00
joshua
3f586b0b8e Fix wrong element type 2021-02-24 20:51:03 +01:00
Laurent Trinques
8ccfb93e89 DiagramView::mouseMoveEvent remove "DEV" in toolTip message mouse
postion
2021-02-24 19:44:12 +01:00
Lars Biskupek
54e2af4fb2 Tab-stop definitions inserted where appropriate
Tab stop definitions inserted in some dialogs, so that the order of tab-stops-moves corresponds as closely as possible to the fields' position in the window.
2021-02-24 19:43:37 +01:00
Lars Biskupek
3e95b51af6 Modifications to SaveFile-Dialog for "Save As PDF"
Fixed a typo that prevented existing PDF files from being displayed in SaveFileDialog for PDFs.

The way the file name for the PDF is generated has changed. If the project has already been saved, the PDF has the same file name (with .pdf of course); If not, the file name is generated from the project title (= same behavior as Save as - dialog for a .qet project file).
2021-02-24 19:43:04 +01:00
joshua
fb58ecacfc Fix typo
Fixed a typo that resulted in existing PDF files not being displayed in
the dialog box "Save As PDF".
Thanks Bisku
2021-02-24 19:42:26 +01:00
Pawel Śmiech
8053303ce5 Polish translation updated
Signed-off-by: Pawel Śmiech <pawel@localhost.localdomain>
2021-02-24 19:41:27 +01:00
47 changed files with 15746 additions and 15232 deletions

View File

@@ -1,20 +0,0 @@
name: Publish Candidate Snap
on:
push:
branches:
- "snap/latest/candidate"
workflow_dispatch:
jobs:
publish_amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: snapcore/action-build@v1
id: build
- uses: snapcore/action-publish@v1
with:
store_login: ${{ secrets.STORE_LOGIN }}
snap: ${{ steps.build.outputs.snap }}
release: candidate

View File

@@ -1,6 +1,73 @@
Changelog
=========
If by accident I have forgotten to credit someone in the CHANGELOG, email me and I will fix it.
__3.2.0__
---------
* Added support for Qt 6 - _Jonas Kvinge_
* Fixed warning in `Qt 5.9` with `min`/`max` functions on Windows - _Nick Korotysh_
* Fix return value of connectToPrimary() when connect is successful - _Jonas Kvinge_
* Fix build issue with MinGW GCC pedantic mode - _Iakov Kirilenko_
* Fixed conversion from `int` to `quint32` and Clang Tidy warnings - _Hennadii Chernyshchyk_
__3.1.5__
---------
* Improved library stability in edge cases and very rapid process initialisation
* Fixed Bug where the shared memory block may have been modified without a lock
* Fixed Bug causing `instanceStarted()` to not get emitted when a second instance
has been started before the primary has initiated it's `QLocalServer`.
__3.1.4__
---------
* Officially supporting and build-testing against Qt 5.15
* Fixed an MSVC C4996 warning that suggests using `strncpy_s`.
_Hennadii Chernyshchyk_
__3.1.3.1__
---------
* CMake build system improvements
* Fixed Clang Tidy warnings
_Hennadii Chernyshchyk_
__3.1.3__
---------
* Improved `CMakeLists.txt`
_Hennadii Chernyshchyk_
__3.1.2__
---------
* Fix a crash when exiting an application on Android and iOS
_Emeric Grange_
__3.1.1a__
----------
* Added currentUser() method that returns the user the current instance is running as.
_Leander Schulten_
__3.1.0a__
----------
* Added primaryUser() method that returns the user the primary instance is running as.
__3.0.19__
----------
* Fixed code warning for depricated functions in Qt 5.10 related to `QTime` and `qrand()`.
_Hennadii Chernyshchyk_
_Anton Filimonov_
_Jonas Kvinge_
__3.0.18__
----------

View File

@@ -1,43 +1,40 @@
cmake_minimum_required(VERSION 3.1.0)
cmake_minimum_required(VERSION 3.7.0)
project(SingleApplication)
project(SingleApplication LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
# SingleApplication base class
set(QAPPLICATION_CLASS QCoreApplication CACHE STRING "Inheritance class for SingleApplication")
set_property(CACHE QAPPLICATION_CLASS PROPERTY STRINGS QApplication QGuiApplication QCoreApplication)
# Libary target
add_library(${PROJECT_NAME} STATIC
singleapplication.cpp
singleapplication_p.cpp
)
)
add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
if(NOT QT_DEFAULT_MAJOR_VERSION)
set(QT_DEFAULT_MAJOR_VERSION 5 CACHE STRING "Qt version to use (5 or 6), defaults to 5")
endif()
# Find dependencies
find_package(Qt5Network)
if(QAPPLICATION_CLASS STREQUAL QApplication)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
elseif(QAPPLICATION_CLASS STREQUAL QGuiApplication)
find_package(Qt5 COMPONENTS Gui REQUIRED)
else()
find_package(Qt5 COMPONENTS Core REQUIRED)
endif()
add_compile_definitions(QAPPLICATION_CLASS=${QAPPLICATION_CLASS})
set(QT_COMPONENTS Core Network)
set(QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::Core Qt${QT_DEFAULT_MAJOR_VERSION}::Network)
# Link dependencies
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Network)
if(QAPPLICATION_CLASS STREQUAL QApplication)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Widgets)
list(APPEND QT_COMPONENTS Widgets)
list(APPEND QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::Widgets)
elseif(QAPPLICATION_CLASS STREQUAL QGuiApplication)
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Gui)
list(APPEND QT_COMPONENTS Gui)
list(APPEND QT_LIBRARIES Qt${QT_DEFAULT_MAJOR_VERSION}::Gui)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core)
set(QAPPLICATION_CLASS QCoreApplication)
endif()
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS ${QT_COMPONENTS} REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC ${QT_LIBRARIES})
if(WIN32)
target_link_libraries(${PROJECT_NAME} PRIVATE advapi32)
endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC QAPPLICATION_CLASS=${QAPPLICATION_CLASS})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

View File

@@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) Itay Grudev 2015 - 2016
Copyright (c) Itay Grudev 2015 - 2020
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,7 +1,8 @@
SingleApplication
=================
[![CI](https://github.com/itay-grudev/SingleApplication/workflows/CI:%20Build%20Test/badge.svg)](https://github.com/itay-grudev/SingleApplication/actions)
This is a replacement of the QtSingleApplication for `Qt5`.
This is a replacement of the QtSingleApplication for `Qt5` and `Qt6`.
Keeps the Primary Instance of your Application and kills each subsequent
instances. It can (if enabled) spawn secondary (non-related to the primary)
@@ -15,18 +16,6 @@ class you specify via the `QAPPLICATION_CLASS` macro (`QCoreApplication` is the
default). Further usage is similar to the use of the `Q[Core|Gui]Application`
classes.
The library sets up a `QLocalServer` and a `QSharedMemory` block. The first
instance of your Application is your Primary Instance. It would check if the
shared memory block exists and if not it will start a `QLocalServer` and listen
for connections. Each subsequent instance of your application would check if the
shared memory block exists and if it does, it will connect to the QLocalServer
to notify the primary instance that a new instance had been started, after which
it would terminate with status code `0`. In the Primary Instance
`SingleApplication` would emit the `instanceStarted()` signal upon detecting
that a new instance had been started.
The library uses `stdlib` to terminate the program with the `exit()` function.
You can use the library as if you use any other `QCoreApplication` derived
class:
@@ -43,8 +32,7 @@ int main( int argc, char* argv[] )
```
To include the library files I would recommend that you add it as a git
submodule to your project and include it's contents with a `.pri` file. Here is
how:
submodule to your project. Here is how:
```bash
git submodule add git@github.com:itay-grudev/SingleApplication.git singleapplication
@@ -66,13 +54,27 @@ Then include the subdirectory in your `CMakeLists.txt` project file.
```cmake
set(QAPPLICATION_CLASS QApplication CACHE STRING "Inheritance class for SingleApplication")
add_subdirectory(src/third-party/singleapplication)
target_link_libraries(${PROJECT_NAME} SingleApplication::SingleApplication)
```
The library sets up a `QLocalServer` and a `QSharedMemory` block. The first
instance of your Application is your Primary Instance. It would check if the
shared memory block exists and if not it will start a `QLocalServer` and listen
for connections. Each subsequent instance of your application would check if the
shared memory block exists and if it does, it will connect to the QLocalServer
to notify the primary instance that a new instance had been started, after which
it would terminate with status code `0`. In the Primary Instance
`SingleApplication` would emit the `instanceStarted()` signal upon detecting
that a new instance had been started.
The library uses `stdlib` to terminate the program with the `exit()` function.
Also don't forget to specify which `QCoreApplication` class your app is using if it
is not `QCoreApplication` as in examples above.
The `Instance Started` signal
------------------------
-----------------------------
The SingleApplication class implements a `instanceStarted()` signal. You can
bind to that signal to raise your application's window when a new instance had
@@ -137,13 +139,22 @@ app.isSecondary();
*__Note:__ If your Primary Instance is terminated a newly launched instance
will replace the Primary one even if the Secondary flag has been set.*
Examples
--------
There are three examples provided in this repository:
* Basic example that prevents a secondary instance from starting [`examples/basic`](https://github.com/itay-grudev/SingleApplication/tree/master/examples/basic)
* An example of a graphical application raising it's parent window [`examples/calculator`](https://github.com/itay-grudev/SingleApplication/tree/master/examples/calculator)
* A console application sending the primary instance it's command line parameters [`examples/sending_arguments`](https://github.com/itay-grudev/SingleApplication/tree/master/examples/sending_arguments)
API
---
### Members
```cpp
SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 100 )
SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 100, QString userData = QString() )
```
Depending on whether `allowSecondary` is set, this constructor may terminate
@@ -152,7 +163,7 @@ can be specified to set whether the SingleApplication block should work
user-wide or system-wide. Additionally the `Mode::SecondaryNotification` may be
used to notify the primary instance whenever a secondary instance had been
started (disabled by default). `timeout` specifies the maximum time in
milliseconds to wait for blocking operations.
milliseconds to wait for blocking operations. Setting `userData` provides additional data that will isolate this instance from other instances that do not have the same (or any) user data set.
*__Note:__ `argc` and `argv` may be changed as Qt removes arguments that it
recognizes.*
@@ -204,6 +215,22 @@ qint64 SingleApplication::primaryPid()
Returns the process ID (PID) of the primary instance.
---
```cpp
QString SingleApplication::primaryUser()
```
Returns the username the primary instance is running as.
---
```cpp
QString SingleApplication::currentUser()
```
Returns the username the current instance is running as.
### Signals
```cpp

View File

@@ -0,0 +1 @@
#include "singleapplication.h"

View File

@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.7.0)
project(basic LANGUAGES CXX)
# SingleApplication base class
set(QAPPLICATION_CLASS QCoreApplication)
add_subdirectory(../.. SingleApplication)
add_executable(basic main.cpp)
target_link_libraries(${PROJECT_NAME} SingleApplication::SingleApplication)

0
SingleApplication/examples/basic/basic.pro Normal file → Executable file
View File

2
SingleApplication/examples/basic/main.cpp Normal file → Executable file
View File

@@ -5,5 +5,7 @@ int main(int argc, char *argv[])
// Allow secondary instances
SingleApplication app( argc, argv );
qWarning() << "Started a new instance";
return app.exec();
}

View File

@@ -0,0 +1,21 @@
cmake_minimum_required(VERSION 3.7.0)
project(calculator LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
# SingleApplication base class
set(QAPPLICATION_CLASS QApplication)
add_subdirectory(../.. SingleApplication)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Core REQUIRED)
add_executable(${PROJECT_NAME}
button.h
calculator.h
button.cpp
calculator.cpp
main.cpp
)
target_link_libraries(${PROJECT_NAME} SingleApplication::SingleApplication)

View File

@@ -82,27 +82,27 @@ Calculator::Calculator(QWidget *parent)
digitButtons[i] = createButton(QString::number(i), SLOT(digitClicked()));
}
Button *pointButton = createButton(tr("."), SLOT(pointClicked()));
Button *changeSignButton = createButton(tr("\302\261"), SLOT(changeSignClicked()));
Button *pointButton = createButton(".", SLOT(pointClicked()));
Button *changeSignButton = createButton("\302\261", SLOT(changeSignClicked()));
Button *backspaceButton = createButton(tr("Backspace"), SLOT(backspaceClicked()));
Button *clearButton = createButton(tr("Clear"), SLOT(clear()));
Button *clearAllButton = createButton(tr("Clear All"), SLOT(clearAll()));
Button *backspaceButton = createButton("Backspace", SLOT(backspaceClicked()));
Button *clearButton = createButton("Clear", SLOT(clear()));
Button *clearAllButton = createButton("Clear All", SLOT(clearAll()));
Button *clearMemoryButton = createButton(tr("MC"), SLOT(clearMemory()));
Button *readMemoryButton = createButton(tr("MR"), SLOT(readMemory()));
Button *setMemoryButton = createButton(tr("MS"), SLOT(setMemory()));
Button *addToMemoryButton = createButton(tr("M+"), SLOT(addToMemory()));
Button *clearMemoryButton = createButton("MC", SLOT(clearMemory()));
Button *readMemoryButton = createButton("MR", SLOT(readMemory()));
Button *setMemoryButton = createButton("MS", SLOT(setMemory()));
Button *addToMemoryButton = createButton("M+", SLOT(addToMemory()));
Button *divisionButton = createButton(tr("\303\267"), SLOT(multiplicativeOperatorClicked()));
Button *timesButton = createButton(tr("\303\227"), SLOT(multiplicativeOperatorClicked()));
Button *minusButton = createButton(tr("-"), SLOT(additiveOperatorClicked()));
Button *plusButton = createButton(tr("+"), SLOT(additiveOperatorClicked()));
Button *divisionButton = createButton("\303\267", SLOT(multiplicativeOperatorClicked()));
Button *timesButton = createButton("\303\227", SLOT(multiplicativeOperatorClicked()));
Button *minusButton = createButton("-", SLOT(additiveOperatorClicked()));
Button *plusButton = createButton("+", SLOT(additiveOperatorClicked()));
Button *squareRootButton = createButton(tr("Sqrt"), SLOT(unaryOperatorClicked()));
Button *powerButton = createButton(tr("x\302\262"), SLOT(unaryOperatorClicked()));
Button *reciprocalButton = createButton(tr("1/x"), SLOT(unaryOperatorClicked()));
Button *equalButton = createButton(tr("="), SLOT(equalClicked()));
Button *squareRootButton = createButton("Sqrt", SLOT(unaryOperatorClicked()));
Button *powerButton = createButton("x\302\262", SLOT(unaryOperatorClicked()));
Button *reciprocalButton = createButton("1/x", SLOT(unaryOperatorClicked()));
Button *equalButton = createButton("=", SLOT(equalClicked()));
//! [4]
//! [5]
@@ -140,7 +140,7 @@ Calculator::Calculator(QWidget *parent)
mainLayout->addWidget(equalButton, 5, 5);
setLayout(mainLayout);
setWindowTitle(tr("Calculator"));
setWindowTitle("Calculator");
}
//! [6]
@@ -169,15 +169,15 @@ void Calculator::unaryOperatorClicked()
double operand = display->text().toDouble();
double result = 0.0;
if (clickedOperator == tr("Sqrt")) {
if (clickedOperator == "Sqrt") {
if (operand < 0.0) {
abortOperation();
return;
}
result = std::sqrt(operand);
} else if (clickedOperator == tr("x\302\262")) {
} else if (clickedOperator == "x\302\262") {
result = std::pow(operand, 2.0);
} else if (clickedOperator == tr("1/x")) {
} else if (clickedOperator == "1/x") {
if (operand == 0.0) {
abortOperation();
return;
@@ -287,7 +287,7 @@ void Calculator::pointClicked()
if (waitingForOperand)
display->setText("0");
if (!display->text().contains('.'))
display->setText(display->text() + tr("."));
display->setText(display->text() + ".");
waitingForOperand = false;
}
//! [22]
@@ -299,7 +299,7 @@ void Calculator::changeSignClicked()
double value = text.toDouble();
if (value > 0.0) {
text.prepend(tr("-"));
text.prepend("-");
} else if (value < 0.0) {
text.remove(0, 1);
}
@@ -383,20 +383,20 @@ Button *Calculator::createButton(const QString &text, const char *member)
void Calculator::abortOperation()
{
clearAll();
display->setText(tr("####"));
display->setText("####");
}
//! [36]
//! [38]
bool Calculator::calculate(double rightOperand, const QString &pendingOperator)
{
if (pendingOperator == tr("+")) {
if (pendingOperator == "+") {
sumSoFar += rightOperand;
} else if (pendingOperator == tr("-")) {
} else if (pendingOperator == "-") {
sumSoFar -= rightOperand;
} else if (pendingOperator == tr("\303\227")) {
} else if (pendingOperator == "\303\227") {
factorSoFar *= rightOperand;
} else if (pendingOperator == tr("\303\267")) {
} else if (pendingOperator == "\303\267") {
if (rightOperand == 0.0)
return false;
factorSoFar /= rightOperand;

View File

@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.7.0)
project(sending_arguments LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
# SingleApplication base class
set(QAPPLICATION_CLASS QCoreApplication)
add_subdirectory(../.. SingleApplication)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Core REQUIRED)
add_executable(${PROJECT_NAME}
main.cpp
messagereceiver.cpp
messagereceiver.h
main.cpp
)
target_link_libraries(${PROJECT_NAME} SingleApplication::SingleApplication)

3
SingleApplication/examples/sending_arguments/main.cpp Normal file → Executable file
View File

@@ -11,6 +11,9 @@ int main(int argc, char *argv[])
// If this is a secondary instance
if( app.isSecondary() ) {
app.sendMessage( app.arguments().join(' ').toUtf8() );
qDebug() << "App already running.";
qDebug() << "Primary instance PID: " << app.primaryPid();
qDebug() << "Primary instance user: " << app.primaryUser();
return 0;
} else {
QObject::connect(

View File

View File

@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) Itay Grudev 2015 - 2018
// Copyright (c) Itay Grudev 2015 - 2020
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -20,32 +20,26 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include <QtCore/QTime>
#include <QtCore/QThread>
#include <QtCore/QDateTime>
#include <QtCore/QElapsedTimer>
#include <QtCore/QByteArray>
#include <QtCore/QSharedMemory>
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) // ### Qt 6: remove
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 5.10 or later")
#endif
#include <QRandomGenerator>
#endif
#include "singleapplication.h"
#include "singleapplication_p.h"
/**
@brief Constructor. Checks and fires up LocalServer or closes the program
if another instance already exists
@param argc
@param argv
@param {bool} allowSecondaryInstances
*/
SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary, Options options, int timeout )
* @brief Constructor. Checks and fires up LocalServer or closes the program
* if another instance already exists
* @param argc
* @param argv
* @param allowSecondary Whether to enable secondary instance support
* @param options Optional flags to toggle specific behaviour
* @param timeout Maximum time blocking functions are allowed during app load
*/
SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSecondary, Options options, int timeout, const QString &userData )
: app_t( argc, argv ), d_ptr( new SingleApplicationPrivate( this ) )
{
Q_D(SingleApplication);
Q_D( SingleApplication );
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
// On Android and iOS since the library is not supported fallback to
@@ -57,10 +51,18 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
// Store the current mode of the program
d->options = options;
// Add any unique user data
if ( ! userData.isEmpty() )
d->addAppData( userData );
// Generating an application ID used for identifying the shared memory
// block and QLocalServer
d->genBlockServerName();
// To mitigate QSharedMemory issues with large amount of processes
// attempting to attach at the same time
SingleApplicationPrivate::randomSleep();
#ifdef Q_OS_UNIX
// By explicitly attaching it and then deleting it we make sure that the
// memory is deleted even after the process has crashed on Unix.
@@ -72,71 +74,86 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
d->memory = new QSharedMemory( d->blockServerName );
// Create a shared memory block
if( d->memory->create( sizeof( InstancesInfo ) ) ) {
if( d->memory->create( sizeof( InstancesInfo ) )){
// Initialize the shared memory block
d->memory->lock();
if( ! d->memory->lock() ){
qCritical() << "SingleApplication: Unable to lock memory block after create.";
abortSafely();
}
d->initializeMemoryBlock();
d->memory->unlock();
} else {
if( d->memory->error() == QSharedMemory::AlreadyExists ){
// Attempt to attach to the memory segment
if( ! d->memory->attach() ) {
if( ! d->memory->attach() ){
qCritical() << "SingleApplication: Unable to attach to shared memory block.";
qCritical() << d->memory->errorString();
delete d;
::exit( EXIT_FAILURE );
abortSafely();
}
if( ! d->memory->lock() ){
qCritical() << "SingleApplication: Unable to lock memory block after attach.";
abortSafely();
}
} else {
qCritical() << "SingleApplication: Unable to create block.";
abortSafely();
}
}
InstancesInfo* inst = static_cast<InstancesInfo*>( d->memory->data() );
auto *inst = static_cast<InstancesInfo*>( d->memory->data() );
QElapsedTimer time;
time.start();
// Make sure the shared memory block is initialised and in consistent state
while( true ) {
d->memory->lock();
while( true ){
// If the shared memory block's checksum is valid continue
if( d->blockChecksum() == inst->checksum ) break;
if( time.elapsed() > 5000 ) {
// If more than 5s have elapsed, assume the primary instance crashed and
// assume it's position
if( time.elapsed() > 5000 ){
qWarning() << "SingleApplication: Shared memory block has been in an inconsistent state from more than 5s. Assuming primary instance failure.";
d->initializeMemoryBlock();
}
d->memory->unlock();
// Random sleep here limits the probability of a collision between two racing apps
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) // ### Qt 6: remove
qsrand( QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max() );
QThread::sleep( 8 + static_cast <unsigned long>( static_cast <float>( qrand() ) / RAND_MAX * 10 ) );
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 5.10 or later")
#endif
quint32 value = QRandomGenerator::global()->generate();
QThread::sleep(8 + static_cast<unsigned long>(value / RAND_MAX * 10));
#endif
// Otherwise wait for a random period and try again. The random sleep here
// limits the probability of a collision between two racing apps and
// allows the app to initialise faster
if( ! d->memory->unlock() ){
qDebug() << "SingleApplication: Unable to unlock memory for random wait.";
qDebug() << d->memory->errorString();
}
SingleApplicationPrivate::randomSleep();
if( ! d->memory->lock() ){
qCritical() << "SingleApplication: Unable to lock memory after random wait.";
abortSafely();
}
}
if( inst->primary == false) {
if( inst->primary == false ){
d->startPrimary();
d->memory->unlock();
if( ! d->memory->unlock() ){
qDebug() << "SingleApplication: Unable to unlock memory after primary start.";
qDebug() << d->memory->errorString();
}
return;
}
// Check if another instance can be started
if( allowSecondary ) {
inst->secondary += 1;
inst->checksum = d->blockChecksum();
d->instanceNumber = inst->secondary;
if( allowSecondary ){
d->startSecondary();
if( d->options & Mode::SecondaryNotification ) {
if( d->options & Mode::SecondaryNotification ){
d->connectToPrimary( timeout, SingleApplicationPrivate::SecondaryInstance );
}
d->memory->unlock();
if( ! d->memory->unlock() ){
qDebug() << "SingleApplication: Unable to unlock memory after secondary start.";
qDebug() << d->memory->errorString();
}
return;
}
d->memory->unlock();
if( ! d->memory->unlock() ){
qDebug() << "SingleApplication: Unable to unlock memory at end of execution.";
qDebug() << d->memory->errorString();
}
d->connectToPrimary( timeout, SingleApplicationPrivate::NewInstance );
@@ -145,51 +162,113 @@ SingleApplication::SingleApplication( int &argc, char *argv[], bool allowSeconda
::exit( EXIT_SUCCESS );
}
/**
@brief Destructor
*/
SingleApplication::~SingleApplication()
{
Q_D(SingleApplication);
Q_D( SingleApplication );
delete d;
}
bool SingleApplication::isPrimary()
/**
* Checks if the current application instance is primary.
* @return Returns true if the instance is primary, false otherwise.
*/
bool SingleApplication::isPrimary() const
{
Q_D(SingleApplication);
Q_D( const SingleApplication );
return d->server != nullptr;
}
bool SingleApplication::isSecondary()
/**
* Checks if the current application instance is secondary.
* @return Returns true if the instance is secondary, false otherwise.
*/
bool SingleApplication::isSecondary() const
{
Q_D(SingleApplication);
Q_D( const SingleApplication );
return d->server == nullptr;
}
quint32 SingleApplication::instanceId()
/**
* Allows you to identify an instance by returning unique consecutive instance
* ids. It is reset when the first (primary) instance of your app starts and
* only incremented afterwards.
* @return Returns a unique instance id.
*/
quint32 SingleApplication::instanceId() const
{
Q_D(SingleApplication);
Q_D( const SingleApplication );
return d->instanceNumber;
}
qint64 SingleApplication::primaryPid()
/**
* Returns the OS PID (Process Identifier) of the process running the primary
* instance. Especially useful when SingleApplication is coupled with OS.
* specific APIs.
* @return Returns the primary instance PID.
*/
qint64 SingleApplication::primaryPid() const
{
Q_D(SingleApplication);
Q_D( const SingleApplication );
return d->primaryPid();
}
bool SingleApplication::sendMessage( QByteArray message, int timeout )
/**
* Returns the username the primary instance is running as.
* @return Returns the username the primary instance is running as.
*/
QString SingleApplication::primaryUser() const
{
Q_D(SingleApplication);
Q_D( const SingleApplication );
return d->primaryUser();
}
/**
* Returns the username the current instance is running as.
* @return Returns the username the current instance is running as.
*/
QString SingleApplication::currentUser() const
{
return SingleApplicationPrivate::getUsername();
}
/**
* Sends message to the Primary Instance.
* @param message The message to send.
* @param timeout the maximum timeout in milliseconds for blocking functions.
* @return true if the message was sent successfuly, false otherwise.
*/
bool SingleApplication::sendMessage( const QByteArray &message, int timeout )
{
Q_D( SingleApplication );
// Nobody to connect to
if( isPrimary() ) return false;
// Make sure the socket is connected
d->connectToPrimary( timeout, SingleApplicationPrivate::Reconnect );
if( ! d->connectToPrimary( timeout, SingleApplicationPrivate::Reconnect ) )
return false;
d->socket->write( message );
bool dataWritten = d->socket->waitForBytesWritten( timeout );
d->socket->flush();
return dataWritten;
}
/**
* Cleans up the shared memory block and exits with a failure.
* This function halts program execution.
*/
void SingleApplication::abortSafely()
{
Q_D( SingleApplication );
qCritical() << "SingleApplication: " << d->memory->error() << d->memory->errorString();
delete d;
::exit( EXIT_FAILURE );
}
QStringList SingleApplication::userData() const
{
Q_D( const SingleApplication );
return d->appData();
}

View File

@@ -25,7 +25,6 @@
#include <QtCore/QtGlobal>
#include <QtNetwork/QLocalSocket>
#include <QElapsedTimer>
#ifndef QAPPLICATION_CLASS
#define QAPPLICATION_CLASS QCoreApplication
@@ -36,26 +35,26 @@
class SingleApplicationPrivate;
/**
@brief The SingleApplication class handles multiple instances of the same
Application
@see QCoreApplication
*/
* @brief The SingleApplication class handles multiple instances of the same
* Application
* @see QCoreApplication
*/
class SingleApplication : public QAPPLICATION_CLASS
{
Q_OBJECT
typedef QAPPLICATION_CLASS app_t;
using app_t = QAPPLICATION_CLASS;
public:
public:
/**
@brief Mode of operation of SingleApplication.
Whether the block should be user-wide or system-wide and whether the
primary instance should be notified when a secondary instance had been
started.
@note Operating system can restrict the shared memory blocks to the same
user, in which case the User/System modes will have no effect and the
block will be user wide.
@enum
* @brief Mode of operation of SingleApplication.
* Whether the block should be user-wide or system-wide and whether the
* primary instance should be notified when a secondary instance had been
* started.
* @note Operating system can restrict the shared memory blocks to the same
* user, in which case the User/System modes will have no effect and the
* block will be user wide.
* @enum
*/
enum Mode {
User = 1 << 0,
@@ -67,68 +66,87 @@ class SingleApplication : public QAPPLICATION_CLASS
Q_DECLARE_FLAGS(Options, Mode)
/**
@brief Intitializes a SingleApplication instance with argc command line
arguments in argv
@arg {int &} argc - Number of arguments in argv
@arg {const char *[]} argv - Supplied command line arguments
@arg {bool} allowSecondary - Whether to start the instance as secondary
if there is already a primary instance.
@arg {Mode} mode - Whether for the SingleApplication block to be applied
User wide or System wide.
@arg {int} timeout - Timeout to wait in milliseconds.
@note argc and argv may be changed as Qt removes arguments that it
recognizes
@note Mode::SecondaryNotification only works if set on both the primary
instance and the secondary instance.
@note The timeout is just a hint for the maximum time of blocking
operations. It does not guarantee that the SingleApplication
initialisation will be completed in given time, though is a good hint.
Usually 4*timeout would be the worst case (fail) scenario.
@see See the corresponding QAPPLICATION_CLASS constructor for reference
* @brief Intitializes a SingleApplication instance with argc command line
* arguments in argv
* @arg {int &} argc - Number of arguments in argv
* @arg {const char *[]} argv - Supplied command line arguments
* @arg {bool} allowSecondary - Whether to start the instance as secondary
* if there is already a primary instance.
* @arg {Mode} mode - Whether for the SingleApplication block to be applied
* User wide or System wide.
* @arg {int} timeout - Timeout to wait in milliseconds.
* @note argc and argv may be changed as Qt removes arguments that it
* recognizes
* @note Mode::SecondaryNotification only works if set on both the primary
* instance and the secondary instance.
* @note The timeout is just a hint for the maximum time of blocking
* operations. It does not guarantee that the SingleApplication
* initialisation will be completed in given time, though is a good hint.
* Usually 4*timeout would be the worst case (fail) scenario.
* @see See the corresponding QAPPLICATION_CLASS constructor for reference
*/
explicit SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 1000 );
~SingleApplication();
explicit SingleApplication( int &argc, char *argv[], bool allowSecondary = false, Options options = Mode::User, int timeout = 1000, const QString &userData = {} );
~SingleApplication() override;
/**
@brief Returns if the instance is the primary instance
@returns {bool}
* @brief Returns if the instance is the primary instance
* @returns {bool}
*/
bool isPrimary();
bool isPrimary() const;
/**
@brief Returns if the instance is a secondary instance
@returns {bool}
* @brief Returns if the instance is a secondary instance
* @returns {bool}
*/
bool isSecondary();
bool isSecondary() const;
/**
@brief Returns a unique identifier for the current instance
@returns {qint32}
* @brief Returns a unique identifier for the current instance
* @returns {qint32}
*/
quint32 instanceId();
quint32 instanceId() const;
/**
@brief Returns the process ID (PID) of the primary instance
@returns {qint64}
* @brief Returns the process ID (PID) of the primary instance
* @returns {qint64}
*/
qint64 primaryPid();
qint64 primaryPid() const;
/**
@brief Sends a message to the primary instance. Returns true on success.
@param {int} timeout - Timeout for connecting
@returns {bool}
@note sendMessage() will return false if invoked from the primary
instance.
* @brief Returns the username of the user running the primary instance
* @returns {QString}
*/
bool sendMessage( QByteArray message, int timeout = 100 );
QString primaryUser() const;
Q_SIGNALS:
/**
* @brief Returns the username of the current user
* @returns {QString}
*/
QString currentUser() const;
/**
* @brief Sends a message to the primary instance. Returns true on success.
* @param {int} timeout - Timeout for connecting
* @returns {bool}
* @note sendMessage() will return false if invoked from the primary
* instance.
*/
bool sendMessage( const QByteArray &message, int timeout = 100 );
/**
* @brief Get the set user data.
* @returns {QStringList}
*/
QStringList userData() const;
Q_SIGNALS:
void instanceStarted();
void receivedMessage( quint32 instanceId, QByteArray message );
private:
private:
SingleApplicationPrivate *d_ptr;
Q_DECLARE_PRIVATE(SingleApplication)
void abortSafely();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(SingleApplication::Options)

View File

@@ -1,7 +1,8 @@
QT += core network
CONFIG += c++17
CONFIG += c++11
HEADERS += $$PWD/singleapplication.h \
HEADERS += $$PWD/SingleApplication \
$$PWD/singleapplication.h \
$$PWD/singleapplication_p.h
SOURCES += $$PWD/singleapplication.cpp \
$$PWD/singleapplication_p.cpp

View File

@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) Itay Grudev 2015 - 2018
// Copyright (c) Itay Grudev 2015 - 2020
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -33,12 +33,20 @@
#include <cstddef>
#include <QtCore/QDir>
#include <QtCore/QThread>
#include <QtCore/QByteArray>
#include <QtCore/QDataStream>
#include <QtCore/QElapsedTimer>
#include <QtCore/QCryptographicHash>
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
#include <QtCore/QRandomGenerator>
#else
#include <QtCore/QDateTime>
#endif
#include "singleapplication.h"
#include "singleapplication_p.h"
@@ -49,8 +57,11 @@
#endif
#ifdef Q_OS_WIN
#include <windows.h>
#include <lmcons.h>
#ifndef NOMINMAX
#define NOMINMAX 1
#endif
#include <windows.h>
#include <lmcons.h>
#endif
SingleApplicationPrivate::SingleApplicationPrivate( SingleApplication *q_ptr )
@@ -59,28 +70,62 @@ SingleApplicationPrivate::SingleApplicationPrivate( SingleApplication *q_ptr )
server = nullptr;
socket = nullptr;
memory = nullptr;
instanceNumber = -1;
instanceNumber = 0;
}
SingleApplicationPrivate::~SingleApplicationPrivate()
{
if( socket != nullptr ) {
if( socket != nullptr ){
socket->close();
delete socket;
}
if( memory != nullptr ){
memory->lock();
InstancesInfo* inst = static_cast<InstancesInfo*>(memory->data());
if( server != nullptr ) {
auto *inst = static_cast<InstancesInfo*>(memory->data());
if( server != nullptr ){
server->close();
delete server;
inst->primary = false;
inst->primaryPid = -1;
inst->primaryUser[0] = '\0';
inst->checksum = blockChecksum();
}
memory->unlock();
delete memory;
}
}
QString SingleApplicationPrivate::getUsername()
{
#ifdef Q_OS_WIN
wchar_t username[UNLEN + 1];
// Specifies size of the buffer on input
DWORD usernameLength = UNLEN + 1;
if( GetUserNameW( username, &usernameLength ) )
return QString::fromWCharArray( username );
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
return QString::fromLocal8Bit( qgetenv( "USERNAME" ) );
#else
return qEnvironmentVariable( "USERNAME" );
#endif
#endif
#ifdef Q_OS_UNIX
QString username;
uid_t uid = geteuid();
struct passwd *pw = getpwuid( uid );
if( pw )
username = QString::fromLocal8Bit( pw->pw_name );
if ( username.isEmpty() ){
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
username = QString::fromLocal8Bit( qgetenv( "USER" ) );
#else
username = qEnvironmentVariable( "USER" );
#endif
}
return username;
#endif
}
void SingleApplicationPrivate::genBlockServerName()
@@ -91,11 +136,14 @@ void SingleApplicationPrivate::genBlockServerName()
appData.addData( SingleApplication::app_t::organizationName().toUtf8() );
appData.addData( SingleApplication::app_t::organizationDomain().toUtf8() );
if( ! (options & SingleApplication::Mode::ExcludeAppVersion) ) {
if ( ! appDataList.isEmpty() )
appData.addData( appDataList.join( "" ).toUtf8() );
if( ! (options & SingleApplication::Mode::ExcludeAppVersion) ){
appData.addData( SingleApplication::app_t::applicationVersion().toUtf8() );
}
if( ! (options & SingleApplication::Mode::ExcludeAppPath) ) {
if( ! (options & SingleApplication::Mode::ExcludeAppPath) ){
#ifdef Q_OS_WIN
appData.addData( SingleApplication::app_t::applicationFilePath().toLower().toUtf8() );
#else
@@ -104,29 +152,8 @@ void SingleApplicationPrivate::genBlockServerName()
}
// User level block requires a user specific data in the hash
if( options & SingleApplication::Mode::User ) {
#ifdef Q_OS_WIN
wchar_t username [ UNLEN + 1 ];
// Specifies size of the buffer on input
DWORD usernameLength = UNLEN + 1;
if( GetUserNameW( username, &usernameLength ) ) {
appData.addData( QString::fromWCharArray(username).toUtf8() );
} else {
appData.addData( qgetenv("USERNAME") );
}
#endif
#ifdef Q_OS_UNIX
QByteArray username;
uid_t uid = geteuid();
struct passwd *pw = getpwuid(uid);
if( pw ) {
username = pw->pw_name;
}
if( username.isEmpty() ) {
username = qgetenv("USER");
}
appData.addData(username);
#endif
if( options & SingleApplication::Mode::User ){
appData.addData( getUsername().toUtf8() );
}
// Replace the backslash in RFC 2045 Base64 [a-zA-Z0-9+/=] to comply with
@@ -134,19 +161,26 @@ void SingleApplicationPrivate::genBlockServerName()
blockServerName = appData.result().toBase64().replace("/", "_");
}
void SingleApplicationPrivate::initializeMemoryBlock()
void SingleApplicationPrivate::initializeMemoryBlock() const
{
InstancesInfo* inst = static_cast<InstancesInfo*>( memory->data() );
auto *inst = static_cast<InstancesInfo*>( memory->data() );
inst->primary = false;
inst->secondary = 0;
inst->primaryPid = -1;
inst->primaryUser[0] = '\0';
inst->checksum = blockChecksum();
}
void SingleApplicationPrivate::startPrimary()
{
Q_Q(SingleApplication);
// Reset the number of connections
auto *inst = static_cast <InstancesInfo*>( memory->data() );
inst->primary = true;
inst->primaryPid = QCoreApplication::applicationPid();
qstrncpy( inst->primaryUser, getUsername().toUtf8().data(), sizeof(inst->primaryUser) );
inst->checksum = blockChecksum();
instanceNumber = 0;
// Successful creation means that no main process exists
// So we start a QLocalServer to listen for connections
QLocalServer::removeServer( blockServerName );
@@ -154,7 +188,7 @@ void SingleApplicationPrivate::startPrimary()
// Restrict access to the socket according to the
// SingleApplication::Mode::User flag on User level or no restrictions
if( options & SingleApplication::Mode::User ) {
if( options & SingleApplication::Mode::User ){
server->setSocketOptions( QLocalServer::UserAccessOption );
} else {
server->setSocketOptions( QLocalServer::WorldAccessOption );
@@ -167,47 +201,51 @@ void SingleApplicationPrivate::startPrimary()
this,
&SingleApplicationPrivate::slotConnectionEstablished
);
// Reset the number of connections
InstancesInfo* inst = static_cast <InstancesInfo*>( memory->data() );
inst->primary = true;
inst->primaryPid = q->applicationPid();
inst->checksum = blockChecksum();
instanceNumber = 0;
}
void SingleApplicationPrivate::startSecondary()
{
auto *inst = static_cast <InstancesInfo*>( memory->data() );
inst->secondary += 1;
inst->checksum = blockChecksum();
instanceNumber = inst->secondary;
}
void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType connectionType )
bool SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType connectionType )
{
QElapsedTimer time;
time.start();
// Connect to the Local Server of the Primary Instance if not already
// connected.
if( socket == nullptr ) {
if( socket == nullptr ){
socket = new QLocalSocket();
}
// If already connected - we are done;
if( socket->state() == QLocalSocket::ConnectedState )
return;
if( socket->state() == QLocalSocket::ConnectedState ) return true;
// If not connect
if( socket->state() == QLocalSocket::UnconnectedState ||
socket->state() == QLocalSocket::ClosingState ) {
if( socket->state() != QLocalSocket::ConnectedState ){
while( true ){
randomSleep();
if( socket->state() != QLocalSocket::ConnectingState )
socket->connectToServer( blockServerName );
if( socket->state() == QLocalSocket::ConnectingState ){
socket->waitForConnected( static_cast<int>(msecs - time.elapsed()) );
}
// Wait for being connected
if( socket->state() == QLocalSocket::ConnectingState ) {
socket->waitForConnected( msecs );
// If connected break out of the loop
if( socket->state() == QLocalSocket::ConnectedState ) break;
// If elapsed time since start is longer than the method timeout return
if( time.elapsed() >= msecs ) return false;
}
}
// Initialisation message according to the SingleApplication protocol
if( socket->state() == QLocalSocket::ConnectedState ) {
// Notify the parent that a new instance had been started;
QByteArray initMsg;
QDataStream writeStream(&initMsg, QIODevice::WriteOnly);
@@ -218,21 +256,10 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
writeStream << blockServerName.toLatin1();
writeStream << static_cast<quint8>(connectionType);
writeStream << instanceNumber;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
quint16 checksum =
qChecksum(
initMsg.constData(),
static_cast<quint32>(initMsg.length()));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
quint16 checksum = qChecksum(QByteArray(initMsg, static_cast<quint32>(initMsg.length())));
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
quint16 checksum =
qChecksum(
QByteArrayView(
initMsg.constData(),
static_cast<quint32>(initMsg.length())));
quint16 checksum = qChecksum(initMsg.constData(), static_cast<quint32>(initMsg.length()));
#endif
writeStream << checksum;
@@ -247,68 +274,72 @@ void SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
socket->write( header );
socket->write( initMsg );
bool result = socket->waitForBytesWritten( static_cast<int>(msecs - time.elapsed()) );
socket->flush();
socket->waitForBytesWritten( msecs );
}
return result;
}
quint16 SingleApplicationPrivate::blockChecksum()
quint16 SingleApplicationPrivate::blockChecksum() const
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
return qChecksum(
static_cast <const char *>( memory->data() ),
offsetof( InstancesInfo, checksum )
);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
quint16 checksum = qChecksum(QByteArray(static_cast<const char*>(memory->constData()), offsetof(InstancesInfo, checksum)));
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
return qChecksum(
QByteArrayView(
static_cast <const char *>( memory->data() ),
offsetof( InstancesInfo, checksum )));
quint16 checksum = qChecksum(static_cast<const char*>(memory->constData()), offsetof(InstancesInfo, checksum));
#endif
return checksum;
}
qint64 SingleApplicationPrivate::primaryPid()
qint64 SingleApplicationPrivate::primaryPid() const
{
qint64 pid;
memory->lock();
InstancesInfo* inst = static_cast<InstancesInfo*>( memory->data() );
auto *inst = static_cast<InstancesInfo*>( memory->data() );
pid = inst->primaryPid;
memory->unlock();
return pid;
}
QString SingleApplicationPrivate::primaryUser() const
{
QByteArray username;
memory->lock();
auto *inst = static_cast<InstancesInfo*>( memory->data() );
username = inst->primaryUser;
memory->unlock();
return QString::fromUtf8( username );
}
/**
@brief Executed when a connection has been made to the LocalServer
*/
* @brief Executed when a connection has been made to the LocalServer
*/
void SingleApplicationPrivate::slotConnectionEstablished()
{
QLocalSocket *nextConnSocket = server->nextPendingConnection();
connectionMap.insert(nextConnSocket, ConnectionInfo());
QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose,
[nextConnSocket, this]() {
[nextConnSocket, this](){
auto &info = connectionMap[nextConnSocket];
Q_EMIT this->slotClientConnectionClosed( nextConnSocket, info.instanceId );
}
);
QObject::connect(nextConnSocket, &QLocalSocket::disconnected,
QObject::connect(nextConnSocket, &QLocalSocket::disconnected, nextConnSocket, &QLocalSocket::deleteLater);
QObject::connect(nextConnSocket, &QLocalSocket::destroyed,
[nextConnSocket, this](){
connectionMap.remove(nextConnSocket);
nextConnSocket->deleteLater();
}
);
QObject::connect(nextConnSocket, &QLocalSocket::readyRead,
[nextConnSocket, this]() {
[nextConnSocket, this](){
auto &info = connectionMap[nextConnSocket];
switch(info.stage) {
switch(info.stage){
case StageHeader:
readInitMessageHeader(nextConnSocket);
break;
@@ -327,11 +358,11 @@ void SingleApplicationPrivate::slotConnectionEstablished()
void SingleApplicationPrivate::readInitMessageHeader( QLocalSocket *sock )
{
if (!connectionMap.contains( sock )) {
if (!connectionMap.contains( sock )){
return;
}
if( sock->bytesAvailable() < ( qint64 )sizeof( quint64 ) ) {
if( sock->bytesAvailable() < ( qint64 )sizeof( quint64 ) ){
return;
}
@@ -348,7 +379,7 @@ void SingleApplicationPrivate::readInitMessageHeader( QLocalSocket *sock )
info.stage = StageBody;
info.msgLen = msgLen;
if ( sock->bytesAvailable() >= (qint64) msgLen ) {
if ( sock->bytesAvailable() >= (qint64) msgLen ){
readInitMessageBody( sock );
}
}
@@ -357,12 +388,12 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
{
Q_Q(SingleApplication);
if (!connectionMap.contains( sock )) {
if (!connectionMap.contains( sock )){
return;
}
ConnectionInfo &info = connectionMap[sock];
if( sock->bytesAvailable() < ( qint64 )info.msgLen ) {
if( sock->bytesAvailable() < ( qint64 )info.msgLen ){
return;
}
@@ -392,26 +423,17 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
quint16 msgChecksum = 0;
readStream >> msgChecksum;
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
const quint16 actualChecksum =
qChecksum(
msgBytes.constData(),
static_cast<quint32>( msgBytes.length() - sizeof( quint16 ) ) );
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const quint16 actualChecksum = qChecksum(QByteArray(msgBytes, static_cast<quint32>(msgBytes.length() - sizeof(quint16))));
#else
#if TODO_LIST
#pragma message("@TODO remove code for QT 6 or later")
#endif
const quint16 actualChecksum =
qChecksum(
QByteArrayView(
msgBytes.constData(),
static_cast<quint32>(msgBytes.length() - sizeof(quint16))));
const quint16 actualChecksum = qChecksum(msgBytes.constData(), static_cast<quint32>(msgBytes.length() - sizeof(quint16)));
#endif
bool isValid = readStream.status() == QDataStream::Ok &&
QLatin1String(latin1Name) == blockServerName &&
msgChecksum == actualChecksum;
if( !isValid ) {
if( !isValid ){
sock->close();
return;
}
@@ -426,7 +448,7 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
Q_EMIT q->instanceStarted();
}
if (sock->bytesAvailable() > 0) {
if (sock->bytesAvailable() > 0){
Q_EMIT this->slotDataAvailable( sock, instanceId );
}
}
@@ -442,3 +464,23 @@ void SingleApplicationPrivate::slotClientConnectionClosed( QLocalSocket *closedS
if( closedSocket->bytesAvailable() > 0 )
Q_EMIT slotDataAvailable( closedSocket, instanceId );
}
void SingleApplicationPrivate::randomSleep()
{
#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 )
QThread::msleep( QRandomGenerator::global()->bounded( 8u, 18u ));
#else
qsrand( QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max() );
QThread::msleep( 8 + static_cast <unsigned long>( static_cast <float>( qrand() ) / RAND_MAX * 10 ));
#endif
}
void SingleApplicationPrivate::addAppData(const QString &data)
{
appDataList.push_back(data);
}
QStringList SingleApplicationPrivate::appData() const
{
return appDataList;
}

View File

@@ -1,6 +1,6 @@
// The MIT License (MIT)
//
// Copyright (c) Itay Grudev 2015 - 2016
// Copyright (c) Itay Grudev 2015 - 2020
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
@@ -41,20 +41,19 @@ struct InstancesInfo {
bool primary;
quint32 secondary;
qint64 primaryPid;
quint16 checksum;
char primaryUser[128];
quint16 checksum; // Must be the last field
};
struct ConnectionInfo {
explicit ConnectionInfo() :
msgLen(0), instanceId(0), stage(0) {}
qint64 msgLen;
quint32 instanceId;
quint8 stage;
qint64 msgLen = 0;
quint32 instanceId = 0;
quint8 stage = 0;
};
class SingleApplicationPrivate : public QObject {
Q_OBJECT
public:
Q_OBJECT
public:
enum ConnectionType : quint8 {
InvalidConnection = 0,
NewInstance = 1,
@@ -69,17 +68,22 @@ class SingleApplicationPrivate : public QObject {
Q_DECLARE_PUBLIC(SingleApplication)
SingleApplicationPrivate( SingleApplication *q_ptr );
~SingleApplicationPrivate();
~SingleApplicationPrivate() override;
static QString getUsername();
void genBlockServerName();
void initializeMemoryBlock();
void initializeMemoryBlock() const;
void startPrimary();
void startSecondary();
void connectToPrimary(int msecs, ConnectionType connectionType );
quint16 blockChecksum();
qint64 primaryPid();
bool connectToPrimary( int msecs, ConnectionType connectionType );
quint16 blockChecksum() const;
qint64 primaryPid() const;
QString primaryUser() const;
void readInitMessageHeader(QLocalSocket *socket);
void readInitMessageBody(QLocalSocket *socket);
static void randomSleep();
void addAppData(const QString &data);
QStringList appData() const;
SingleApplication *q_ptr;
QSharedMemory *memory;
@@ -89,8 +93,9 @@ class SingleApplicationPrivate : public QObject {
QString blockServerName;
SingleApplication::Options options;
QMap<QLocalSocket*, ConnectionInfo> connectionMap;
QStringList appDataList;
public Q_SLOTS:
public Q_SLOTS:
void slotConnectionEstablished();
void slotDataAvailable( QLocalSocket*, quint32 );
void slotClientConnectionClosed( QLocalSocket*, quint32 );

View File

@@ -1,5 +1,15 @@
#!/bin/sh
# a KDE session forces the KDE Plasma platformtheme which is incompatible with QET
# unset the ENV vars in that case to prevent loading of the theme
if [ ! -z "$KDE_FULL_SESSION" ]; then
unset KDE_FULL_SESSION
fi
if echo "$XDG_CURRENT_DESKTOP" | grep -q KDE; then
unset XDG_CURRENT_DESKTOP
fi
# migrate .qet directory from SNAP_USER_DATA to SNAP_USER_COMMON
from="$SNAP_USER_DATA/.qet"
to="$SNAP_USER_COMMON/.qet"
@@ -13,4 +23,12 @@ fi
mkdir -p "$HOME/.qet"
ln -snf "$SNAP/bin/DXFtoQET" "$HOME/.qet/DXFtoQET"
# start desktop portal. Open & save dialogs might fail if it is not running
dbus-send --print-reply \
--dest=org.freedesktop.DBus \
/org/freedesktop/DBus \
org.freedesktop.DBus.StartServiceByName \
string:org.freedesktop.portal.Desktop \
uint32:0
exec "${@}"

View File

@@ -1,7 +1,7 @@
name: qelectrotech
title: QElectroTech
base: core20
version: "0.8.0"
base: core18
adopt-info: qelectrotech
license: GPL-2.0
summary: Electrical diagram editor
description: |
@@ -10,7 +10,10 @@ description: |
grade: stable
confinement: strict
compression: lzo
architectures:
- build-on: amd64
run-on: amd64
layout:
/usr/local/share/qelectrotech:
@@ -27,14 +30,15 @@ apps:
extensions: [kde-neon]
plugs: &plugs [opengl, unity7, home, removable-media, gsettings, network, cups-control]
environment: &env
__EGL_VENDOR_LIBRARY_DIRS: $SNAP/kf5/usr/share/glvnd/egl_vendor.d:$SNAP/usr/share/glvnd/egl_vendor.d
TCL_LIBRARY: $SNAP/usr/share/tcltk/tcl8.6
QT_QPA_PLATFORMTHEME: gtk3
QT_AUTO_SCREEN_SCALE_FACTOR: 1
HOME: $SNAP_USER_COMMON
PYTHONPATH: $SNAP:$SNAP/lib/python3.8/site-packages:$SNAP/usr/lib/python3.8:$SNAP/usr/lib/python3.8/lib-dynload
PYTHONPATH: $SNAP:$SNAP/lib/python3.6/site-packages:$SNAP/usr/lib/python3.6:$SNAP/usr/lib/python3.6/lib-dynload
qet-tb-generator:
command: bin/qet_tb_generator
command-chain:
- bin/qelectrotech-launch
command: bin/qelectrotech-launch $SNAP/bin/qet_tb_generator
extensions: [kde-neon]
plugs: *plugs
environment: *env
@@ -54,8 +58,8 @@ parts:
qet-tb-generator:
plugin: python
source: https://github.com/raulroda/qet_tb_generator-plugin.git
python-packages: [PySimpleGUI]
python-version: python3
source: https://github.com/qelectrotech/qet_tb_generator.git
stage-packages:
- python3-lxml
- python3-tk
@@ -64,14 +68,14 @@ parts:
kde-sdk-setup:
plugin: nil
build-snaps:
- kde-frameworks-5-qt-5-15-3-core20-sdk
- kde-frameworks-5-core18-sdk
build-packages:
- g++
- mesa-common-dev
- libglvnd-dev
- rsync
override-build: |
rsync -a --ignore-existing /snap/kde-frameworks-5-qt-5-15-3-core20-sdk/current/ /
rsync -a --ignore-existing /snap/kde-frameworks-5-core18-sdk/current/ /
dxf-to-qet:
after: [kde-sdk-setup]
@@ -87,15 +91,19 @@ parts:
after: [kde-sdk-setup]
plugin: nil
source: .
stage-packages: [ git, sqlite3, xdg-user-dirs ]
stage-packages: [ git, sqlite3 ]
build-packages:
- git
- libsqlite3-dev
override-build: |
modified_displayed_version="${SNAPCRAFT_PROJECT_VERSION}.snap"
override-pull: |
snapcraftctl pull
snap_version=$(git describe --dirty)
modified_displayed_version=$snap_version".snap"
sed -i -E "s|const QString displayedVersion =.*|const QString displayedVersion =\"$modified_displayed_version\";|" sources/qet.h
snapcraftctl set-version "$snap_version"
override-build: |
qmake "$SNAPCRAFT_PART_SRC/qelectrotech.pro"
make -j${SNAPCRAFT_PARALLEL_BUILD_COUNT}
make -j$(nproc)
make install INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL"
override-stage: |
snapcraftctl stage
@@ -106,14 +114,11 @@ parts:
cleanup:
after: [qelectrotech, dxf-to-qet, qet-tb-generator]
plugin: nil
build-snaps: [kde-frameworks-5-qt-5-15-3-core20]
build-snaps: [core18, kde-frameworks-5-core18]
override-prime: |
# Remove all files from snap that are already included in the base snap or in
# any connected content snaps
set -eux
for snap in "kde-frameworks-5-qt-5-15-3-core20"; do # List all content-snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" "$SNAPCRAFT_PRIME/usr/{}" \;
for snap in "core18" "kde-frameworks-5-core18"; do # List all content-snaps and base snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
done
for cruft in bug lintian man; do
rm -rf $SNAPCRAFT_PRIME/usr/share/$cruft
done
find $SNAPCRAFT_PRIME/usr/share/doc/ -type f -not -name 'copyright' -delete
find $SNAPCRAFT_PRIME/usr/share -type d -empty -delete

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="52" version="0.51" hotspot_x="56" link_type="simple" width="70" type="element" height="100">
<definition hotspot_y="52" version="0.51" hotspot_x="56" link_type="master" width="70" type="element" height="100">
<uuid uuid="{2d6c186b-0578-4682-90c9-f77843432e9f}"/>
<names>
<name lang="cs">Motorový spouštěč 1P+N</name>
@@ -12,6 +12,9 @@
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
<name lang="hu">Motorvédő kapcsoló 1 pólusú GV</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<polygon x1="0" y1="14" x5="0" y4="4" y5="4" x6="0" y7="-25" x2="0" y6="-6" y2="10" y3="10" x7="-7" antialias="true" x3="5" closed="false" x4="5" style="line-style:normal;line-weight:normal;filling:none;color:black"/>

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="52" width="70" version="0.51" type="element" height="100" hotspot_x="56" link_type="simple">
<definition hotspot_y="52" width="70" version="0.51" type="element" height="100" hotspot_x="56" link_type="master">
<uuid uuid="{ec5fa3cd-6769-4a35-aaa9-6bc5ba4fc779}"/>
<names>
<name lang="fr">Disjoncteur Magnéto-thermique GV 2P</name>
@@ -8,6 +8,9 @@
<name lang="cs">Motorový spouštěč 2P</name>
<name lang="hu">Motorvédő kapcsoló 2 pólusú GV</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<polygon y2="10" x3="-15" y4="4" x2="-20" y3="10" x5="-20" style="line-style:normal;line-weight:normal;filling:none;color:black" x1="-20" x4="-15" closed="false" y1="14" y6="-6" x7="-27" y5="4" antialias="true" y7="-25" x6="-20"/>

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="52" version="0.51" hotspot_x="56" link_type="simple" width="110" type="element" height="100">
<definition hotspot_y="52" version="0.51" hotspot_x="56" link_type="master" width="110" type="element" height="100">
<uuid uuid="{2424a938-847f-447f-a4ad-d9b6ef730fd9}"/>
<names>
<name lang="de">Motorschutzschalter</name>
@@ -12,6 +12,9 @@
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
<name lang="hu">Motorvédő kapcsoló 3F + N pólusú</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<line end1="none" x1="40" y1="39" x2="40" length1="1.5" y2="28" antialias="false" end2="none" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black"/>

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="50" width="110" version="0.51" type="element" height="100" hotspot_x="56" link_type="simple">
<definition hotspot_y="50" width="110" version="0.51" type="element" height="100" hotspot_x="56" link_type="master">
<uuid uuid="{686e19c6-6bce-4ced-8c01-2d7f58a78386}"/>
<names>
<name lang="el">Θερμομαγνητικό</name>
@@ -12,6 +12,9 @@
<name lang="de">Motorschutzschalter</name>
<name lang="hu">Motorvédő kapcsoló 4 pólusú GV</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<line y2="28" end1="none" length2="1.5" x2="40" style="line-style:normal;line-weight:normal;filling:none;color:black" x1="40" length1="1.5" y1="39" end2="none" antialias="false"/>

View File

@@ -1,4 +1,4 @@
<definition type="element" link_type="simple" hotspot_x="31" hotspot_y="4" version="0.5" width="90" height="70">
<definition type="element" link_type="master" hotspot_x="31" hotspot_y="4" version="0.5" width="90" height="70">
<uuid uuid="{98ADF831-42F0-4EDE-9267-6733EEBEAF62}"/><names>
<name lang="en">Motor circuit breaker</name>
<name lang="es">Disyuntor termico magnetico 3P mando manual con auto retorno y boton de desenclave</name>
@@ -10,6 +10,9 @@
<name lang="pl">Wyłącznik silnikowy</name>
<name lang="hu">Motorvédő kapcsoló 3 pólusú</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations>Author: The QElectroTech team
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
<description>

View File

@@ -1,4 +1,4 @@
<definition type="element" link_type="simple" hotspot_x="33" hotspot_y="5" version="0.5" width="110" height="70">
<definition type="element" link_type="master" hotspot_x="33" hotspot_y="5" version="0.5" width="110" height="70">
<uuid uuid="{C33FE39E-B2EE-4EC0-BC3F-4EB76E9BCEA0}"/><names>
<name lang="en">Motor circuit breaker with neutral</name>
<name lang="es">Disyuntor termico magnetico 3P+N mando manual con auto retorno y boton de desenclave</name>
@@ -10,6 +10,9 @@
<name lang="pl">Wyłącznik silnikowy</name>
<name lang="hu">Motorvédő kapcsoló 3F + N pólusú</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations>Author: The QElectroTech team
License: see http://qelectrotech.org/wiki/doc/elements_license</informations>
<description>

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="70" type="element" height="110">
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="70" type="element" height="110">
<uuid uuid="{68830151-5901-40f6-b94d-dc68b85165a2}"/>
<names>
<name lang="fr">Disjoncteur differentiel 1P+N</name>
@@ -8,6 +8,9 @@
<name lang="cs">Jističochránič 2P</name>
<name lang="hu">Differenciál-védőkapcsoló 1P+N termikus és zárlatvédelemmel</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<line end1="none" x1="-29.6203" y1="28" x2="10" length1="1.5" y2="28" antialias="false" end2="none" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black"/>

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="110" type="element" height="110">
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="110" type="element" height="110">
<uuid uuid="{3fa48846-98c0-43e1-8a96-330d4dc11ceb}"/>
<names>
<name lang="cs">Jističochránič 3P+N</name>
@@ -12,6 +12,9 @@
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
<name lang="hu">Differenciál-védőkapcsoló 3P+N termikus és zárlatvédelemmel</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<line end1="none" x1="-29.6203" y1="28" x2="49.5887" length1="1.5" y2="28" antialias="false" end2="none" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black"/>

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="70" type="element" height="110">
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="70" type="element" height="110">
<uuid uuid="{20f65431-6f1f-4e09-9c73-68a1431c40a1}"/>
<names>
<name lang="fr">Disjoncteur differentiel 2P</name>
@@ -8,6 +8,9 @@
<name lang="cs">Jističochránič 2P</name>
<name lang="hu">Differenciál-védőkapcsoló 2P termikus és zárlatvédelemmel</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<polygon x1="-20" y1="14" x5="-20" y4="4" y5="4" x6="-20" y7="-25" x2="-20" y6="-6" y2="10" y3="10" x7="-27" antialias="true" x3="-15" closed="false" x4="-15" style="line-style:normal;line-weight:normal;filling:none;color:black"/>

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="90" type="element" height="110">
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="90" type="element" height="110">
<uuid uuid="{1e746e43-1906-4ea0-99a6-261e3c862dba}"/>
<names>
<name lang="cs">Jističochránič 3P</name>
@@ -12,6 +12,9 @@
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
<name lang="hu">Differenciál-védőkapcsoló 3P termikus és zárlatvédelemmel</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<text text="I>" size="9" y="25" x="-24"/>

View File

@@ -1,4 +1,4 @@
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="simple" width="110" type="element" height="110">
<definition hotspot_y="50" version="0.51" hotspot_x="56" link_type="master" width="110" type="element" height="110">
<uuid uuid="{fee3faef-5f4a-4a0b-bf0e-b6e93d9f9425}"/>
<names>
<name lang="de">Motorschutzschalter</name>
@@ -12,6 +12,9 @@
<name lang="ar">قاطع مغناطيسي-حراري GV</name>
<name lang="hu">Differenciál-védőkapcsoló 4P termikus és zárlatvédelemmel</name>
</names>
<kindInformations>
<kindInformation name="type" show="1">protection</kindInformation>
</kindInformations>
<informations></informations>
<description>
<polygon x1="-20" y1="14" x5="-20" y4="4" y5="4" x6="-20" y7="-25" x2="-20" y6="-6" y2="10" y3="10" x7="-27" antialias="true" x3="-15" closed="false" x4="-15" style="line-style:normal;line-weight:normal;filling:none;color:black"/>

Binary file not shown.

View File

@@ -826,7 +826,7 @@ Uwaga: te opcje nie pozwalają na zablokowanie automatycznej numeracji tylko ust
<message>
<location filename="../sources/ui/conductorpropertieswidget.ui" line="58"/>
<source>Couleur du texte:</source>
<translation>Kolor tekstu</translation>
<translation>Kolor tekstu:</translation>
</message>
<message>
<location filename="../sources/ui/conductorpropertieswidget.ui" line="151"/>
@@ -2600,7 +2600,7 @@ Wszystkie elementy i podkatalogi znajdujące się w tym katalogu zostaną usuni
<message>
<location filename="../sources/editor/ui/ellipseeditor.ui" line="23"/>
<source>Centre :</source>
<translation>Środek</translation>
<translation>Środek:</translation>
</message>
<message>
<location filename="../sources/editor/ui/ellipseeditor.ui" line="30"/>
@@ -5005,7 +5005,7 @@ Poniższe zmienne są zgodne:
<message>
<location filename="../sources/print/projectprintwindow.ui" line="225"/>
<source>Si cette option est cochée, les marges de la feuille seront ignorées et toute sa surface sera utilisée pour l&apos;impression. Cela peut ne pas être supporté par votre imprimante.</source>
<translation>Jeżeli ta opcja jest zaznaczona, marginesy arkusza zostaną zignorowane, a cała jego powierzchnia zostanie wykorzystana do drukowania. Może to nie być obsługiwane przez Twoją drukarkę. </translation>
<translation>Jeżeli ta opcja jest zaznaczona, marginesy arkusza zostaną zignorowane, a cała jego powierzchnia zostanie wykorzystana do drukowania. Może to nie być obsługiwane przez Twoją drukarkę.</translation>
</message>
<message>
<location filename="../sources/print/projectprintwindow.ui" line="259"/>
@@ -5117,7 +5117,7 @@ Poniższe zmienne są zgodne:
<message>
<location filename="../sources/print/projectprintwindow.cpp" line="669"/>
<source>Exporter sous : </source>
<translation>Eksportuj jako:</translation>
<translation>Eksportuj jako: </translation>
</message>
<message>
<location filename="../sources/print/projectprintwindow.cpp" line="669"/>
@@ -6670,7 +6670,8 @@ Put DXFtoQET.exe binary on C:\Users\user_name\AppData\Roaming\qet\ directory
Odwiedź https://download.tuxfamily.org/qet/builds/dxf_to_elmt/
&gt;&gt; Instalacja w Windows
Przenieś DXFtoQET.exe binary do C:\Users\user_name\AppData\Roaming\qet\ directory</translation>
Przenieś DXFtoQET.exe binary do C:\Users\user_name\AppData\Roaming\qet\ directory
</translation>
</message>
<message>
<location filename="../sources/editor/qetelementeditor.cpp" line="169"/>
@@ -6684,7 +6685,8 @@ Put DXFtoQET.app binary on /Users/user_name/.qet/ directory
Odwiedź https://download.tuxfamily.org/qet/builds/dxf_to_elmt/
&gt;&gt; Instalacja w macOSX
Przenieś DXFtoQET.app binary do /Users/user_name/.qet/ directory</translation>
Przenieś DXFtoQET.app binary do /Users/user_name/.qet/ directory
</translation>
</message>
<message>
<location filename="../sources/editor/qetelementeditor.cpp" line="175"/>
@@ -6700,7 +6702,8 @@ Odwiedź https://download.tuxfamily.org/qet/builds/dxf_to_elmt/
&gt;&gt; Instalacja w Linux
Preznieś DXFtoQET binary do twojego /home/user_name/.qet/ directory
make it executable : chmod +x ./DXFtoQE</translation>
make it executable : chmod +x ./DXFtoQE
</translation>
</message>
<message>
<location filename="../sources/editor/qetelementeditor.cpp" line="295"/>
@@ -8773,14 +8776,14 @@ Czy chcesz ją zastąpić?</translation>
<source>Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par les tableaux.
Veuillez ajouter un nouveau tableau ou regler les tableaux existant afin d&apos;afficher l&apos;integralité des informations.</source>
<translation>Wyświetlane informacje większe niż maksymalna liczba, którą można wyświetlić w tabelach.
Dodaj nową tabelę lub dostosuj istniejące tabele, aby wyświetlić wszystkie informacje. </translation>
Dodaj nową tabelę lub dostosuj istniejące tabele, aby wyświetlić wszystkie informacje.</translation>
</message>
<message>
<location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="118"/>
<source>Les information à afficher sont supérieurs à la quantité maximal pouvant être affiché par le tableau.
Veuillez ajouter un nouveau tableau ou regler le tableau existant afin d&apos;afficher l&apos;integralité des informations.</source>
<translation>Wyświetlane informacje większe niż maksymalna liczba, którą można wyświetlić w tabeli.
Dodaj nową tabelę lub dostosuj istniejącą, aby wyświetlić wszystkie informacje. </translation>
Dodaj nową tabelę lub dostosuj istniejącą, aby wyświetlić wszystkie informacje.</translation>
</message>
<message>
<location filename="../sources/qetgraphicsitem/ViewItem/qetgraphicstableitem.cpp" line="121"/>

View File

@@ -501,7 +501,7 @@ void DiagramView::mousePressEvent(QMouseEvent *e)
*/
void DiagramView::mouseMoveEvent(QMouseEvent *e)
{
setToolTip(tr("(Dev) X: %1 Y: %2").arg(e->pos().x()).arg(e->pos().y()));
setToolTip(tr("X: %1 Y: %2").arg(e->pos().x()).arg(e->pos().y()));
if (m_event_interface && m_event_interface->mouseMoveEvent(e)) return;
// Drag the view

View File

@@ -95,13 +95,13 @@ void ProjectPrintWindow::launchDialog(QETProject *project, QPrinter::OutputForma
QString ProjectPrintWindow::docName(QETProject *project)
{
QString doc_name;
if (!project->title().isEmpty()) {
doc_name = project->title();
} else if (!project->filePath().isEmpty()) {
if (!project->filePath().isEmpty()) {
doc_name = QFileInfo(project->filePath()).baseName();
} else if (!project->title().isEmpty()) {
doc_name = project->title();
doc_name = QET::stringToFileName(doc_name);
}
doc_name = QET::stringToFileName(doc_name);
if (doc_name.isEmpty()) {
doc_name = tr("projet", "string used to generate a filename");
}
@@ -666,7 +666,7 @@ QList<Diagram *> ProjectPrintWindow::selectedDiagram() const
void ProjectPrintWindow::exportToPDF()
{
auto file_name = QFileDialog::getSaveFileName(this, tr("Exporter sous : "), m_printer->outputFileName(), tr("Fichier (*.pdf"));
auto file_name = QFileDialog::getSaveFileName(this, tr("Exporter sous : "), m_printer->outputFileName(), tr("Fichier (*.pdf)"));
if (file_name.isEmpty()) {
return;
}

View File

@@ -339,11 +339,8 @@ QString ProjectView::askUserForFilePath(bool assign) {
// if no filepath is provided, return an empty string
if (filepath.isEmpty()) return(filepath);
// if the name does not end with the .qet extension and we're _not_ using xdg-desktop-portal, append it
bool usesPortal =
qEnvironmentVariableIsSet("FLATPAK_ID") ||
qEnvironmentVariableIsSet("SNAP_NAME");
if (!filepath.endsWith(".qet", Qt::CaseInsensitive) && !usesPortal) filepath += ".qet";
// // if the name does not end with the .qet extension, append it
// if (!filepath.endsWith(".qet", Qt::CaseInsensitive)) filepath += ".qet";
if (assign) {
// assign the provided filepath to the currently edited project

View File

@@ -1,7 +1,7 @@
/**
* pugixml parser - version 1.10
* pugixml parser - version 1.11
* --------------------------------------------------------
* Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
@@ -40,6 +40,9 @@
// #define PUGIXML_MEMORY_OUTPUT_STACK 10240
// #define PUGIXML_MEMORY_XPATH_PAGE_SIZE 4096
// Tune this constant to adjust max nesting for XPath queries
// #define PUGIXML_XPATH_DEPTH_LIMIT 1024
// Uncomment this to switch to header-only version
// #define PUGIXML_HEADER_ONLY
@@ -49,7 +52,7 @@
#endif
/**
* Copyright (c) 2006-2019 Arseny Kapoulkine
* Copyright (c) 2006-2020 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation

View File

@@ -1,7 +1,7 @@
/**
* pugixml parser - version 1.10
* pugixml parser - version 1.11
* --------------------------------------------------------
* Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
@@ -4981,7 +4981,12 @@ PUGI__NS_BEGIN
#if defined(PUGI__MSVC_CRT_VERSION) || defined(__BORLANDC__) || (defined(__MINGW32__) && (!defined(__STRICT_ANSI__) || defined(__MINGW64_VERSION_MAJOR)))
PUGI__FN FILE* open_file_wide(const wchar_t* path, const wchar_t* mode)
{
#if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400
FILE* file = 0;
return _wfopen_s(&file, path, mode) == 0 ? file : 0;
#else
return _wfopen(path, mode);
#endif
}
#else
PUGI__FN char* convert_path_heap(const wchar_t* str)
@@ -5025,6 +5030,16 @@ PUGI__NS_BEGIN
}
#endif
PUGI__FN FILE* open_file(const char* path, const char* mode)
{
#if defined(PUGI__MSVC_CRT_VERSION) && PUGI__MSVC_CRT_VERSION >= 1400
FILE* file = 0;
return fopen_s(&file, path, mode) == 0 ? file : 0;
#else
return fopen(path, mode);
#endif
}
PUGI__FN bool save_file_impl(const xml_document& doc, FILE* file, const char_t* indent, unsigned int flags, xml_encoding encoding)
{
if (!file) return false;
@@ -6127,13 +6142,13 @@ namespace pugi
impl::xml_allocator& alloc = impl::get_allocator(_root);
if (!alloc.reserve()) return false;
for (xml_node_struct* child = _root->first_child; child; )
for (xml_node_struct* cur = _root->first_child; cur; )
{
xml_node_struct* next = child->next_sibling;
xml_node_struct* next = cur->next_sibling;
impl::destroy_node(child, alloc);
impl::destroy_node(cur, alloc);
child = next;
cur = next;
}
_root->first_child = 0;
@@ -7187,7 +7202,7 @@ namespace pugi
reset();
using impl::auto_deleter; // MSVC7 workaround
auto_deleter<FILE> file(fopen(path_, "rb"), impl::close_file);
auto_deleter<FILE> file(impl::open_file(path_, "rb"), impl::close_file);
return impl::load_file_impl(static_cast<impl::xml_document_struct*>(_root), file.data, options, encoding, &_buffer);
}
@@ -7270,7 +7285,7 @@ namespace pugi
PUGI__FN bool xml_document::save_file(const char* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const
{
using impl::auto_deleter; // MSVC7 workaround
auto_deleter<FILE> file(fopen(path_, (flags & format_save_file_text) ? "w" : "wb"), impl::close_file);
auto_deleter<FILE> file(impl::open_file(path_, (flags & format_save_file_text) ? "w" : "wb"), impl::close_file);
return impl::save_file_impl(*this, file.data, indent, flags, encoding);
}
@@ -11143,6 +11158,14 @@ PUGI__NS_BEGIN
}
};
static const size_t xpath_ast_depth_limit =
#ifdef PUGIXML_XPATH_DEPTH_LIMIT
PUGIXML_XPATH_DEPTH_LIMIT
#else
1024
#endif
;
struct xpath_parser
{
xpath_allocator* _alloc;
@@ -11155,6 +11178,8 @@ PUGI__NS_BEGIN
char_t _scratch[32];
size_t _depth;
xpath_ast_node* error(const char* message)
{
_result->error = message;
@@ -11171,6 +11196,11 @@ PUGI__NS_BEGIN
return 0;
}
xpath_ast_node* error_rec()
{
return error("Exceeded maximum allowed query depth");
}
void* alloc_node()
{
return _alloc->allocate(sizeof(xpath_ast_node));
@@ -11526,6 +11556,8 @@ PUGI__NS_BEGIN
return error("Unrecognized function call");
_lexer.next();
size_t old_depth = _depth;
while (_lexer.current() != lex_close_brace)
{
if (argc > 0)
@@ -11535,6 +11567,9 @@ PUGI__NS_BEGIN
_lexer.next();
}
if (++_depth > xpath_ast_depth_limit)
return error_rec();
xpath_ast_node* n = parse_expression();
if (!n) return 0;
@@ -11547,6 +11582,8 @@ PUGI__NS_BEGIN
_lexer.next();
_depth = old_depth;
return parse_function(function, argc, args);
}
@@ -11563,10 +11600,15 @@ PUGI__NS_BEGIN
xpath_ast_node* n = parse_primary_expression();
if (!n) return 0;
size_t old_depth = _depth;
while (_lexer.current() == lex_open_square_brace)
{
_lexer.next();
if (++_depth > xpath_ast_depth_limit)
return error_rec();
if (n->rettype() != xpath_type_node_set)
return error("Predicate has to be applied to node set");
@@ -11582,6 +11624,8 @@ PUGI__NS_BEGIN
_lexer.next();
}
_depth = old_depth;
return n;
}
@@ -11733,12 +11777,17 @@ PUGI__NS_BEGIN
xpath_ast_node* n = alloc_node(ast_step, set, axis, nt_type, nt_name_copy);
if (!n) return 0;
size_t old_depth = _depth;
xpath_ast_node* last = 0;
while (_lexer.current() == lex_open_square_brace)
{
_lexer.next();
if (++_depth > xpath_ast_depth_limit)
return error_rec();
xpath_ast_node* expr = parse_expression();
if (!expr) return 0;
@@ -11755,6 +11804,8 @@ PUGI__NS_BEGIN
last = pred;
}
_depth = old_depth;
return n;
}
@@ -11764,11 +11815,16 @@ PUGI__NS_BEGIN
xpath_ast_node* n = parse_step(set);
if (!n) return 0;
size_t old_depth = _depth;
while (_lexer.current() == lex_slash || _lexer.current() == lex_double_slash)
{
lexeme_t l = _lexer.current();
_lexer.next();
if (++_depth > xpath_ast_depth_limit)
return error_rec();
if (l == lex_double_slash)
{
n = alloc_node(ast_step, n, axis_descendant_or_self, nodetest_type_node, 0);
@@ -11779,6 +11835,8 @@ PUGI__NS_BEGIN
if (!n) return 0;
}
_depth = old_depth;
return n;
}
@@ -11964,6 +12022,9 @@ PUGI__NS_BEGIN
{
_lexer.next();
if (++_depth > xpath_ast_depth_limit)
return error_rec();
xpath_ast_node* rhs = parse_path_or_unary_expression();
if (!rhs) return 0;
@@ -12009,13 +12070,22 @@ PUGI__NS_BEGIN
// | MultiplicativeExpr 'mod' UnaryExpr
xpath_ast_node* parse_expression(int limit = 0)
{
size_t old_depth = _depth;
if (++_depth > xpath_ast_depth_limit)
return error_rec();
xpath_ast_node* n = parse_path_or_unary_expression();
if (!n) return 0;
return parse_expression_rec(n, limit);
n = parse_expression_rec(n, limit);
_depth = old_depth;
return n;
}
xpath_parser(const char_t* query, xpath_variable_set* variables, xpath_allocator* alloc, xpath_parse_result* result): _alloc(alloc), _lexer(query), _query(query), _variables(variables), _result(result)
xpath_parser(const char_t* query, xpath_variable_set* variables, xpath_allocator* alloc, xpath_parse_result* result): _alloc(alloc), _lexer(query), _query(query), _variables(variables), _result(result), _depth(0)
{
}
@@ -12024,6 +12094,8 @@ PUGI__NS_BEGIN
xpath_ast_node* n = parse_expression();
if (!n) return 0;
assert(_depth == 0);
// check if there are unparsed tokens left
if (_lexer.current() != lex_eof)
return error("Incorrect query");
@@ -12923,7 +12995,7 @@ namespace pugi
#endif
/**
* Copyright (c) 2006-2019 Arseny Kapoulkine
* Copyright (c) 2006-2020 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation

View File

@@ -1,7 +1,7 @@
/**
* pugixml parser - version 1.10
* pugixml parser - version 1.11
* --------------------------------------------------------
* Copyright (C) 2006-2019, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Copyright (C) 2006-2020, by Arseny Kapoulkine (arseny.kapoulkine@gmail.com)
* Report bugs and download new versions at https://pugixml.org/
*
* This library is distributed under the MIT License. See notice at the end
@@ -14,7 +14,7 @@
#ifndef PUGIXML_VERSION
// Define version macro; evaluates to major * 1000 + minor * 10 + patch so that it's safe to use in less-than comparisons
// Note: pugixml used major * 100 + minor * 10 + patch format up until 1.9 (which had version identifier 190); starting from pugixml 1.10, the minor version number is two digits
# define PUGIXML_VERSION 1100
# define PUGIXML_VERSION 1110
#endif
// Include user configuration file (this can define various configuration macros)
@@ -1279,13 +1279,13 @@ namespace pugi
bool operator!() const;
};
#ifndef PUGIXML_NO_EXCEPTIONS
#if defined(_MSC_VER)
// C4275 can be ignored in Visual C++ if you are deriving
// from a type in the Standard C++ Library
#pragma warning(push)
#pragma warning(disable: 4275)
#endif
#ifndef PUGIXML_NO_EXCEPTIONS
#if defined(_MSC_VER)
// C4275 can be ignored in Visual C++ if you are deriving
// from a type in the Standard C++ Library
#pragma warning(push)
#pragma warning(disable: 4275)
#endif
// XPath exception class
class PUGIXML_CLASS xpath_exception: public std::exception
{
@@ -1302,10 +1302,10 @@ namespace pugi
// Get parse result
const xpath_parse_result& result() const;
};
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#endif
// XPath node class (either xml_node or xml_attribute)
class PUGIXML_CLASS xpath_node
@@ -1474,7 +1474,7 @@ namespace std
#endif
/**
* Copyright (c) 2006-2019 Arseny Kapoulkine
* Copyright (c) 2006-2020 Arseny Kapoulkine
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation

View File

@@ -98,6 +98,14 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_colums_count_sp</tabstop>
<tabstop>m_columns_width_sp</tabstop>
<tabstop>m_rows_count_sp</tabstop>
<tabstop>m_rows_height_sp</tabstop>
<tabstop>m_display_columns_cb</tabstop>
<tabstop>m_display_rows_cb</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>662</width>
<width>666</width>
<height>418</height>
</rect>
</property>
@@ -581,6 +581,41 @@
<header>kcolorbutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>tabWidget_2</tabstop>
<tabstop>m_multiwires_gb</tabstop>
<tabstop>m_one_text_per_folio_cb</tabstop>
<tabstop>m_text_size_sb</tabstop>
<tabstop>m_formula_le</tabstop>
<tabstop>m_text_le</tabstop>
<tabstop>m_show_text_cb</tabstop>
<tabstop>m_text_color_kpb</tabstop>
<tabstop>m_available_autonum_cb</tabstop>
<tabstop>m_edit_autonum_pb</tabstop>
<tabstop>m_function_le</tabstop>
<tabstop>m_tension_protocol_le</tabstop>
<tabstop>m_wire_color_le</tabstop>
<tabstop>m_wire_section_le</tabstop>
<tabstop>m_cable_le</tabstop>
<tabstop>m_bus_le</tabstop>
<tabstop>m_verti_cb</tabstop>
<tabstop>m_horiz_cb</tabstop>
<tabstop>m_singlewire_gb</tabstop>
<tabstop>m_phase_sb</tabstop>
<tabstop>m_update_preview_pb</tabstop>
<tabstop>m_neutral_cb</tabstop>
<tabstop>m_earth_cb</tabstop>
<tabstop>m_phase_cb</tabstop>
<tabstop>m_phase_slider</tabstop>
<tabstop>m_pen_cb</tabstop>
<tabstop>m_color_kpb</tabstop>
<tabstop>m_color_2_gb</tabstop>
<tabstop>m_dash_size_sb</tabstop>
<tabstop>m_color_2_kpb</tabstop>
<tabstop>m_cond_size_sb</tabstop>
<tabstop>m_line_style_cb</tabstop>
</tabstops>
<resources>
<include location="../../qelectrotech.qrc"/>
</resources>

View File

@@ -17,7 +17,7 @@
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>5</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@@ -811,19 +811,35 @@ Vous pouvez spécifier ici la valeur par défaut de ce champ pour les éléments
</layout>
</widget>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>m_use_system_color_cb</tabstop>
<tabstop>m_use_windows_mode_rb</tabstop>
<tabstop>m_use_tab_mode_rb</tabstop>
<tabstop>m_use_gesture_trackpad</tabstop>
<tabstop>m_zoom_out_beyond_folio</tabstop>
<tabstop>m_use_windows_mode_rb</tabstop>
<tabstop>m_use_tab_mode_rb</tabstop>
<tabstop>m_save_label_paste</tabstop>
<tabstop>m_use_folio_label</tabstop>
<tabstop>m_export_terminal</tabstop>
<tabstop>m_border_0</tabstop>
<tabstop>m_autosave_sb</tabstop>
<tabstop>m_common_elmt_path_cb</tabstop>
<tabstop>m_custom_elmt_path_cb</tabstop>
<tabstop>m_custom_tbt_path_cb</tabstop>
<tabstop>m_highlight_integrated_elements</tabstop>
<tabstop>m_default_elements_info</tabstop>
<tabstop>m_lang_cb</tabstop>
<tabstop>m_dyn_text_font_pb</tabstop>
<tabstop>m_dyn_text_rotation_sb</tabstop>
<tabstop>m_dyn_text_width_sb</tabstop>
<tabstop>m_indi_text_font_pb</tabstop>
<tabstop>m_indi_text_rotation_sb</tabstop>
<tabstop>m_font_pb</tabstop>
<tabstop>DiagramEditor_xGrid_sb</tabstop>
<tabstop>DiagramEditor_yGrid_sb</tabstop>
<tabstop>DiagramEditor_xKeyGrid_sb</tabstop>
<tabstop>DiagramEditor_yKeyGrid_sb</tabstop>
<tabstop>DiagramEditor_xKeyGridFine_sb</tabstop>
<tabstop>DiagramEditor_yKeyGridFine_sb</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@@ -29,7 +29,7 @@
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../../qelectrotech.qrc">
<normaloff>:/ico/16x16/folder-open.png</normaloff>:/ico/16x16/folder-open.png</iconset>
</property>
</widget>
@@ -40,13 +40,21 @@
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../../qelectrotech.qrc">
<normaloff>:/ico/16x16/document-save.png</normaloff>:/ico/16x16/document-save.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<tabstops>
<tabstop>m_combo_box</tabstop>
<tabstop>m_load_pb</tabstop>
<tabstop>m_line_edit</tabstop>
<tabstop>m_save_pb</tabstop>
</tabstops>
<resources>
<include location="../../qelectrotech.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -163,6 +163,16 @@ Veuillez utiliser l'éditeur avancé pour cela.</string>
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_line_edit</tabstop>
<tabstop>m_font_pb</tabstop>
<tabstop>m_advanced_editor_pb</tabstop>
<tabstop>m_x_sb</tabstop>
<tabstop>m_y_sb</tabstop>
<tabstop>m_angle_sb</tabstop>
<tabstop>m_size_sb</tabstop>
<tabstop>m_break_html_pb</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -256,6 +256,15 @@
<header>kcolorbutton.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>m_style_cb</tabstop>
<tabstop>m_size_dsb</tabstop>
<tabstop>m_color_kpb</tabstop>
<tabstop>m_brush_style_cb</tabstop>
<tabstop>m_brush_color_kpb</tabstop>
<tabstop>m_lock_pos_cb</tabstop>
<tabstop>m_close_polygon</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -2,6 +2,14 @@
<ui version="4.0">
<class>XRefPropertiesWidget</class>
<widget class="QWidget" name="XRefPropertiesWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>376</width>
<height>531</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
@@ -265,6 +273,20 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>m_type_cb</tabstop>
<tabstop>m_snap_to_cb</tabstop>
<tabstop>m_offset_sb</tabstop>
<tabstop>m_xrefpos_cb</tabstop>
<tabstop>m_display_has_contacts_rb</tabstop>
<tabstop>m_display_has_cross_rb</tabstop>
<tabstop>m_master_le</tabstop>
<tabstop>m_slave_le</tabstop>
<tabstop>m_show_power_cb</tabstop>
<tabstop>m_power_prefix_le</tabstop>
<tabstop>m_delay_prefix_le</tabstop>
<tabstop>m_switch_prefix_le</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>