Compare commits

..

1 Commits

Author SHA1 Message Date
joshua
98e265da72 Test font size in pixel for DynamicElementTextItem 2021-12-31 18:07:22 +01:00
5521 changed files with 118168 additions and 217251 deletions

View File

@@ -12,9 +12,10 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: snapcore/action-build@v1 - uses: snapcore/action-build@v1
id: build id: build
- uses: snapcore/action-publish@v1
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }}
with: with:
snapcraft-args: --enable-experimental-extensions
- uses: snapcore/action-publish@v1
with:
store_login: ${{ secrets.STORE_LOGIN }}
snap: ${{ steps.build.outputs.snap }} snap: ${{ steps.build.outputs.snap }}
release: edge release: edge

View File

@@ -31,7 +31,7 @@ set(QET_DIR ${PROJECT_SOURCE_DIR})
# Add sub directories # Add sub directories
option(PACKAGE_TESTS "Build the tests" ON) option(PACKAGE_TESTS "Build the tests" ON)
if(PACKAGE_TESTS) if(PACKAGE_TESTS)
message("Add sub directory tests") message("Add sub directorie tests")
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
@@ -147,6 +147,14 @@ install(DIRECTORY examples DESTINATION share/qelectrotech)
install(DIRECTORY titleblocks DESTINATION share/qelectrotech) install(DIRECTORY titleblocks DESTINATION share/qelectrotech)
install(FILES LICENSE ELEMENTS.LICENSE CREDIT README ChangeLog DESTINATION share/doc/qelectrotech) install(FILES LICENSE ELEMENTS.LICENSE CREDIT README ChangeLog DESTINATION share/doc/qelectrotech)
install(FILES misc/qelectrotech.desktop DESTINATION share/applications) install(FILES misc/qelectrotech.desktop DESTINATION share/applications)
install(FILES misc/x-qet-element.xml
misc/x-qet-project.xml
misc/x-qet-titleblock.xml
DESTINATION share/mime/application)
install(FILES misc/x-qet-element.desktop
misc/x-qet-project.desktop
misc/x-qet-titleblock.desktop
DESTINATION share/mimelnk/application)
install(FILES misc/qelectrotech.xml DESTINATION share/mime/packages) install(FILES misc/qelectrotech.xml DESTINATION share/mime/packages)
install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH}) install(FILES misc/qelectrotech.appdata.xml DESTINATION ${QET_APPDATA_PATH})
install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH}) install(FILES ${QM_FILES} DESTINATION ${QET_LANG_PATH})

View File

@@ -1,71 +1,3 @@
====== ChangeLog from 0.9.0 to 0.9.1 ======
*Bug fix:
Avoid WARNING: mime_xml.path is not defined
Update *.qm translations files
Improve 20 logic elements, thanks Vbxier
*Element Editor:
Fix wrong calculation of the bounding rect of an arc
*Diagram editor:
Improve conductor first and last segment position.
Unwanted change of the filling color of shapes in some condition.
====== ChangeLog from 0.8 to 0.9 ======
*Diagram editor :
Improved QElectroTech speed (launch qet, open project, function)
A drop-down list has been added to the toolbar to change the size of the resize handles.
*Element Editor:
The "keep visual rotation" property of element texts is editable from the element editor.
Thanks to the work of antonioaja it is now possible to import a dxf directly from the element editor in a completely transparent way for the user.
In the background QElectroTech uses the dxf2elmt software. https://qelectrotech.org/forum/viewtopic.php?id=2265 https://github.com/antonioaja/dxf2elmt
Improved responsiveness when multiple shapes are selected or deleted, especially when working on a large converted DXF element.
https://qelectrotech.org/forum/viewtopic.php?pid=16612#p16612
*Other:
Add a "side project" tab in the "about" window.
In the general QElectroTech configuration, a drop down list allows to choose the scaling method for hdpi screens.
Allow open polygons (i.e. polylines) when saving in dxf format.
https://qelectrotech.org/forum/viewtopic.php?pid=16611#p16611
Added 'Other' option for slave device contact type.
https://github.com/qelectrotech/qelectrotech-source-mirror/pull/222
https://qelectrotech.org/forum/viewtopic.php?id=2264
*Logs:
Added a QElapsedTimer to calculate the time used to reload the item collection.
Improved QElapsedTimer to calculate the time used to reload the item collection in seconds instead of ms.
Added Linux pc.gpu.RAM information, but requires mesa-utils dependency on the Linux OS.
Added information about mounted disk volumes.
Added CPU architecture for which Qt was compiled in the aboutqetdialog widget and in the logs.
Added MSVC support to MachineInfo.
Added RAM information on Windows of available RAM.
Added QElectroTech version to the log file.
* Elements collection :
Improve collection 8274 elements in 1097 categories (i.e. 9371 files).
* macOS :
Fix sqlite3 database export on macOS, now I use macports with Digikam scripts instead off Homebrew Package Manager.
See: https://invent.kde.org/graphics/digikam/-/tree/master/project/bundles/macports
*Bug fix:
see: https://git.tuxfamily.org/qet/qet.git/log/?h=0.8.1
====== ChangeLog from 0.7 to 0.8 ====== ====== ChangeLog from 0.7 to 0.8 ======

View File

@@ -16,11 +16,11 @@ The main goal of the developers is to provide a libre, easy to use and effective
### Version ### Version
The current stable version is 0.80 and was released on 2021.02.21. The current stable version is 0.80 and was released on 2021.02.21.
Once it has been officially released, the stable version is always frozen and is no longer developed. Once it has been officialy released, the stable version is always frozen and is no longer developed.
New functionalities, bug and issue fixings are further made in the development version (currently 0.9), which can also be [downloaded](https://qelectrotech.org/download.html). New functionalities, bug and issue fixings are further made in the development version (currently 0.9), which can also be [downloaded](https://qelectrotech.org/download.html).
Users who want to test and take benefits from the last software implementations should use the development version. But... use it at your own risk, since things are sometimes broken or only partially implemented until they are done! Users who want to test and take benefits from the last software implementations should use the development version. But... use it at your own risk, since things are sometimes broken or only partialy implemented until they are done!
### License ### License
@@ -28,7 +28,7 @@ The software is licensed under [GNU/GPL](https://www.gnu.org/licenses/old-licens
You are free to use, copy, modify and redistribute it under the terms of the license. You are free to use, copy, modify and redistribute it under the terms of the license.
Like many other open source software, QElectroTech is provided as is, without any warranty. Like many other open source softwares, QElectroTech is provided as it is, without any warranty.
### Development / technical choices ### Development / technical choices

View File

@@ -3,31 +3,6 @@ Changelog
If by accident I have forgotten to credit someone in the CHANGELOG, email me and I will fix it. If by accident I have forgotten to credit someone in the CHANGELOG, email me and I will fix it.
__3.3.4__
---------
* Fix compilation under Qt 6.2+ and stricter Qt compile settings. - _Christoph Cullmann_
__3.3.3__
---------
* Support for Qt 6.3+ - Fixed deprecated `QCryptographicHash::addData()` that will only support `QByteArrayView` going further. - _Moody Liu_
__3.3.2__
---------
* Fixed crash caused by sending a `writeAck` on a removed connection. - _Nicolas Werner_
__3.3.1__
---------
* Added support for _AppImage_ dynamic executable paths. - _Michael Klein_
__3.3.0__
---------
* Fixed message fragmentation issue causing crashes and incorrectly / inconsistently received messages. - _Nils Jeisecke_
__3.2.0__ __3.2.0__
--------- ---------

View File

@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12.0) cmake_minimum_required(VERSION 3.7.0)
project(SingleApplication LANGUAGES CXX) project(SingleApplication LANGUAGES CXX)
@@ -38,13 +38,3 @@ endif()
target_compile_definitions(${PROJECT_NAME} PUBLIC QAPPLICATION_CLASS=${QAPPLICATION_CLASS}) target_compile_definitions(${PROJECT_NAME} PUBLIC QAPPLICATION_CLASS=${QAPPLICATION_CLASS})
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(${PROJECT_NAME} PRIVATE
QT_NO_CAST_TO_ASCII
QT_NO_CAST_FROM_ASCII
QT_NO_URL_CAST_FROM_STRING
QT_NO_CAST_FROM_BYTEARRAY
QT_USE_QSTRINGBUILDER
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
QT_NO_KEYWORDS
QT_NO_FOREACH
)

View File

@@ -35,7 +35,7 @@ To include the library files I would recommend that you add it as a git
submodule to your project. Here is how: submodule to your project. Here is how:
```bash ```bash
git submodule add https://github.com/itay-grudev/SingleApplication.git singleapplication git submodule add git@github.com:itay-grudev/SingleApplication.git singleapplication
``` ```
**Qmake:** **Qmake:**
@@ -182,8 +182,7 @@ bool SingleApplication::sendMessage( QByteArray message, int timeout = 100 )
``` ```
Sends `message` to the Primary Instance. Uses `timeout` as a the maximum timeout Sends `message` to the Primary Instance. Uses `timeout` as a the maximum timeout
in milliseconds for blocking functions. Returns `true` if the message has been sent in milliseconds for blocking functions
successfully. If the message can't be sent or the function timeouts - returns `false`.
--- ---

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

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

@@ -2,6 +2,7 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
// Allow secondary instances
SingleApplication app( argc, argv ); SingleApplication app( argc, argv );
qWarning() << "Started a new instance"; qWarning() << "Started a new instance";

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

View File

View File

@@ -235,7 +235,7 @@ QString SingleApplication::currentUser() const
* Sends message to the Primary Instance. * Sends message to the Primary Instance.
* @param message The message to send. * @param message The message to send.
* @param timeout the maximum timeout in milliseconds for blocking functions. * @param timeout the maximum timeout in milliseconds for blocking functions.
* @return true if the message was sent successfully, false otherwise. * @return true if the message was sent successfuly, false otherwise.
*/ */
bool SingleApplication::sendMessage( const QByteArray &message, int timeout ) bool SingleApplication::sendMessage( const QByteArray &message, int timeout )
{ {
@@ -248,7 +248,10 @@ bool SingleApplication::sendMessage( const QByteArray &message, int timeout )
if( ! d->connectToPrimary( timeout, SingleApplicationPrivate::Reconnect ) ) if( ! d->connectToPrimary( timeout, SingleApplicationPrivate::Reconnect ) )
return false; return false;
return d->writeConfirmedMessage( timeout, message ); d->socket->write( message );
bool dataWritten = d->socket->waitForBytesWritten( timeout );
d->socket->flush();
return dataWritten;
} }
/** /**

View File

@@ -131,34 +131,21 @@ QString SingleApplicationPrivate::getUsername()
void SingleApplicationPrivate::genBlockServerName() void SingleApplicationPrivate::genBlockServerName()
{ {
QCryptographicHash appData( QCryptographicHash::Sha256 ); QCryptographicHash appData( QCryptographicHash::Sha256 );
#if QT_VERSION < QT_VERSION_CHECK(6, 3, 0)
appData.addData( "SingleApplication", 17 ); appData.addData( "SingleApplication", 17 );
#else
appData.addData( QByteArrayView{"SingleApplication"} );
#endif
appData.addData( SingleApplication::app_t::applicationName().toUtf8() ); appData.addData( SingleApplication::app_t::applicationName().toUtf8() );
appData.addData( SingleApplication::app_t::organizationName().toUtf8() ); appData.addData( SingleApplication::app_t::organizationName().toUtf8() );
appData.addData( SingleApplication::app_t::organizationDomain().toUtf8() ); appData.addData( SingleApplication::app_t::organizationDomain().toUtf8() );
if ( ! appDataList.isEmpty() ) if ( ! appDataList.isEmpty() )
appData.addData( appDataList.join(QString()).toUtf8() ); appData.addData( appDataList.join( "" ).toUtf8() );
if( ! (options & SingleApplication::Mode::ExcludeAppVersion) ){ if( ! (options & SingleApplication::Mode::ExcludeAppVersion) ){
appData.addData( SingleApplication::app_t::applicationVersion().toUtf8() ); appData.addData( SingleApplication::app_t::applicationVersion().toUtf8() );
} }
if( ! (options & SingleApplication::Mode::ExcludeAppPath) ){ if( ! (options & SingleApplication::Mode::ExcludeAppPath) ){
#if defined(Q_OS_WIN) #ifdef Q_OS_WIN
appData.addData( SingleApplication::app_t::applicationFilePath().toLower().toUtf8() ); appData.addData( SingleApplication::app_t::applicationFilePath().toLower().toUtf8() );
#elif defined(Q_OS_LINUX)
// If the application is running as an AppImage then the APPIMAGE env var should be used
// instead of applicationPath() as each instance is launched with its own executable path
const QByteArray appImagePath = qgetenv( "APPIMAGE" );
if( appImagePath.isEmpty() ){ // Not running as AppImage: use path to executable file
appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() );
} else { // Running as AppImage: Use absolute path to AppImage file
appData.addData( appImagePath );
};
#else #else
appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() ); appData.addData( SingleApplication::app_t::applicationFilePath().toUtf8() );
#endif #endif
@@ -171,7 +158,7 @@ void SingleApplicationPrivate::genBlockServerName()
// Replace the backslash in RFC 2045 Base64 [a-zA-Z0-9+/=] to comply with // Replace the backslash in RFC 2045 Base64 [a-zA-Z0-9+/=] to comply with
// server naming requirements. // server naming requirements.
blockServerName = QString::fromUtf8(appData.result().toBase64().replace("/", "_")); blockServerName = appData.result().toBase64().replace("/", "_");
} }
void SingleApplicationPrivate::initializeMemoryBlock() const void SingleApplicationPrivate::initializeMemoryBlock() const
@@ -270,52 +257,26 @@ bool SingleApplicationPrivate::connectToPrimary( int msecs, ConnectionType conne
writeStream << static_cast<quint8>(connectionType); writeStream << static_cast<quint8>(connectionType);
writeStream << instanceNumber; writeStream << instanceNumber;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
quint16 checksum = qChecksum(QByteArray(initMsg.constData(), static_cast<quint32>(initMsg.length()))); quint16 checksum = qChecksum(QByteArray(initMsg, static_cast<quint32>(initMsg.length())));
#else #else
quint16 checksum = qChecksum(initMsg.constData(), static_cast<quint32>(initMsg.length())); quint16 checksum = qChecksum(initMsg.constData(), static_cast<quint32>(initMsg.length()));
#endif #endif
writeStream << checksum; writeStream << checksum;
return writeConfirmedMessage( static_cast<int>(msecs - time.elapsed()), initMsg ); // The header indicates the message length that follows
}
void SingleApplicationPrivate::writeAck( QLocalSocket *sock ) {
sock->putChar('\n');
}
bool SingleApplicationPrivate::writeConfirmedMessage (int msecs, const QByteArray &msg)
{
QElapsedTimer time;
time.start();
// Frame 1: The header indicates the message length that follows
QByteArray header; QByteArray header;
QDataStream headerStream(&header, QIODevice::WriteOnly); QDataStream headerStream(&header, QIODevice::WriteOnly);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
headerStream.setVersion(QDataStream::Qt_5_6); headerStream.setVersion(QDataStream::Qt_5_6);
#endif #endif
headerStream << static_cast <quint64>( msg.length() ); headerStream << static_cast <quint64>( initMsg.length() );
if( ! writeConfirmedFrame( static_cast<int>(msecs - time.elapsed()), header )) socket->write( header );
return false; socket->write( initMsg );
bool result = socket->waitForBytesWritten( static_cast<int>(msecs - time.elapsed()) );
// Frame 2: The message
return writeConfirmedFrame( static_cast<int>(msecs - time.elapsed()), msg );
}
bool SingleApplicationPrivate::writeConfirmedFrame( int msecs, const QByteArray &msg )
{
socket->write( msg );
socket->flush(); socket->flush();
return result;
bool result = socket->waitForReadyRead( msecs ); // await ack byte
if (result) {
socket->read( 1 );
return true;
}
return false;
} }
quint16 SingleApplicationPrivate::blockChecksum() const quint16 SingleApplicationPrivate::blockChecksum() const
@@ -360,36 +321,33 @@ void SingleApplicationPrivate::slotConnectionEstablished()
QLocalSocket *nextConnSocket = server->nextPendingConnection(); QLocalSocket *nextConnSocket = server->nextPendingConnection();
connectionMap.insert(nextConnSocket, ConnectionInfo()); connectionMap.insert(nextConnSocket, ConnectionInfo());
QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose, this, QObject::connect(nextConnSocket, &QLocalSocket::aboutToClose,
[nextConnSocket, this](){ [nextConnSocket, this](){
auto &info = connectionMap[nextConnSocket]; auto &info = connectionMap[nextConnSocket];
this->slotClientConnectionClosed( nextConnSocket, info.instanceId ); Q_EMIT this->slotClientConnectionClosed( nextConnSocket, info.instanceId );
} }
); );
QObject::connect(nextConnSocket, &QLocalSocket::disconnected, nextConnSocket, &QLocalSocket::deleteLater); QObject::connect(nextConnSocket, &QLocalSocket::disconnected, nextConnSocket, &QLocalSocket::deleteLater);
QObject::connect(nextConnSocket, &QLocalSocket::destroyed, this, QObject::connect(nextConnSocket, &QLocalSocket::destroyed,
[nextConnSocket, this](){ [nextConnSocket, this](){
connectionMap.remove(nextConnSocket); connectionMap.remove(nextConnSocket);
} }
); );
QObject::connect(nextConnSocket, &QLocalSocket::readyRead, this, QObject::connect(nextConnSocket, &QLocalSocket::readyRead,
[nextConnSocket, this](){ [nextConnSocket, this](){
auto &info = connectionMap[nextConnSocket]; auto &info = connectionMap[nextConnSocket];
switch(info.stage){ switch(info.stage){
case StageInitHeader: case StageHeader:
readMessageHeader( nextConnSocket, StageInitBody ); readInitMessageHeader(nextConnSocket);
break; break;
case StageInitBody: case StageBody:
readInitMessageBody(nextConnSocket); readInitMessageBody(nextConnSocket);
break; break;
case StageConnectedHeader: case StageConnected:
readMessageHeader( nextConnSocket, StageConnectedBody ); Q_EMIT this->slotDataAvailable( nextConnSocket, info.instanceId );
break;
case StageConnectedBody:
this->slotDataAvailable( nextConnSocket, info.instanceId );
break; break;
default: default:
break; break;
@@ -398,7 +356,7 @@ void SingleApplicationPrivate::slotConnectionEstablished()
); );
} }
void SingleApplicationPrivate::readMessageHeader( QLocalSocket *sock, SingleApplicationPrivate::ConnectionStage nextStage ) void SingleApplicationPrivate::readInitMessageHeader( QLocalSocket *sock )
{ {
if (!connectionMap.contains( sock )){ if (!connectionMap.contains( sock )){
return; return;
@@ -418,35 +376,29 @@ void SingleApplicationPrivate::readMessageHeader( QLocalSocket *sock, SingleAppl
quint64 msgLen = 0; quint64 msgLen = 0;
headerStream >> msgLen; headerStream >> msgLen;
ConnectionInfo &info = connectionMap[sock]; ConnectionInfo &info = connectionMap[sock];
info.stage = nextStage; info.stage = StageBody;
info.msgLen = msgLen; info.msgLen = msgLen;
writeAck( sock ); if ( sock->bytesAvailable() >= (qint64) msgLen ){
} readInitMessageBody( sock );
bool SingleApplicationPrivate::isFrameComplete( QLocalSocket *sock )
{
if (!connectionMap.contains( sock )){
return false;
} }
ConnectionInfo &info = connectionMap[sock];
if( sock->bytesAvailable() < ( qint64 )info.msgLen ){
return false;
}
return true;
} }
void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock ) void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
{ {
Q_Q(SingleApplication); Q_Q(SingleApplication);
if( !isFrameComplete( sock ) ) if (!connectionMap.contains( sock )){
return; return;
}
ConnectionInfo &info = connectionMap[sock];
if( sock->bytesAvailable() < ( qint64 )info.msgLen ){
return;
}
// Read the message body // Read the message body
QByteArray msgBytes = sock->readAll(); QByteArray msgBytes = sock->read(info.msgLen);
QDataStream readStream(msgBytes); QDataStream readStream(msgBytes);
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
@@ -472,7 +424,7 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
readStream >> msgChecksum; readStream >> msgChecksum;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const quint16 actualChecksum = qChecksum(QByteArray(msgBytes.constData(), static_cast<quint32>(msgBytes.length() - sizeof(quint16)))); const quint16 actualChecksum = qChecksum(QByteArray(msgBytes, static_cast<quint32>(msgBytes.length() - sizeof(quint16))));
#else #else
const quint16 actualChecksum = qChecksum(msgBytes.constData(), static_cast<quint32>(msgBytes.length() - sizeof(quint16))); const quint16 actualChecksum = qChecksum(msgBytes.constData(), static_cast<quint32>(msgBytes.length() - sizeof(quint16)));
#endif #endif
@@ -486,9 +438,8 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
return; return;
} }
ConnectionInfo &info = connectionMap[sock];
info.instanceId = instanceId; info.instanceId = instanceId;
info.stage = StageConnectedHeader; info.stage = StageConnected;
if( connectionType == NewInstance || if( connectionType == NewInstance ||
( connectionType == SecondaryInstance && ( connectionType == SecondaryInstance &&
@@ -497,30 +448,21 @@ void SingleApplicationPrivate::readInitMessageBody( QLocalSocket *sock )
Q_EMIT q->instanceStarted(); Q_EMIT q->instanceStarted();
} }
writeAck( sock ); if (sock->bytesAvailable() > 0){
Q_EMIT this->slotDataAvailable( sock, instanceId );
}
} }
void SingleApplicationPrivate::slotDataAvailable( QLocalSocket *dataSocket, quint32 instanceId ) void SingleApplicationPrivate::slotDataAvailable( QLocalSocket *dataSocket, quint32 instanceId )
{ {
Q_Q(SingleApplication); Q_Q(SingleApplication);
Q_EMIT q->receivedMessage( instanceId, dataSocket->readAll() );
if ( !isFrameComplete( dataSocket ) )
return;
const QByteArray message = dataSocket->readAll();
writeAck( dataSocket );
ConnectionInfo &info = connectionMap[dataSocket];
info.stage = StageConnectedHeader;
Q_EMIT q->receivedMessage( instanceId, message);
} }
void SingleApplicationPrivate::slotClientConnectionClosed( QLocalSocket *closedSocket, quint32 instanceId ) void SingleApplicationPrivate::slotClientConnectionClosed( QLocalSocket *closedSocket, quint32 instanceId )
{ {
if( closedSocket->bytesAvailable() > 0 ) if( closedSocket->bytesAvailable() > 0 )
slotDataAvailable( closedSocket, instanceId ); Q_EMIT slotDataAvailable( closedSocket, instanceId );
} }
void SingleApplicationPrivate::randomSleep() void SingleApplicationPrivate::randomSleep()
@@ -529,7 +471,7 @@ void SingleApplicationPrivate::randomSleep()
QThread::msleep( QRandomGenerator::global()->bounded( 8u, 18u )); QThread::msleep( QRandomGenerator::global()->bounded( 8u, 18u ));
#else #else
qsrand( QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max() ); qsrand( QDateTime::currentMSecsSinceEpoch() % std::numeric_limits<uint>::max() );
QThread::msleep( qrand() % 11 + 8); QThread::msleep( 8 + static_cast <unsigned long>( static_cast <float>( qrand() ) / RAND_MAX * 10 ));
#endif #endif
} }

View File

@@ -61,10 +61,9 @@ public:
Reconnect = 3 Reconnect = 3
}; };
enum ConnectionStage : quint8 { enum ConnectionStage : quint8 {
StageInitHeader = 0, StageHeader = 0,
StageInitBody = 1, StageBody = 1,
StageConnectedHeader = 2, StageConnected = 2,
StageConnectedBody = 3,
}; };
Q_DECLARE_PUBLIC(SingleApplication) Q_DECLARE_PUBLIC(SingleApplication)
@@ -80,12 +79,8 @@ public:
quint16 blockChecksum() const; quint16 blockChecksum() const;
qint64 primaryPid() const; qint64 primaryPid() const;
QString primaryUser() const; QString primaryUser() const;
bool isFrameComplete(QLocalSocket *sock); void readInitMessageHeader(QLocalSocket *socket);
void readMessageHeader(QLocalSocket *socket, ConnectionStage nextStage);
void readInitMessageBody(QLocalSocket *socket); void readInitMessageBody(QLocalSocket *socket);
void writeAck(QLocalSocket *sock);
bool writeConfirmedFrame(int msecs, const QByteArray &msg);
bool writeConfirmedMessage(int msecs, const QByteArray &msg);
static void randomSleep(); static void randomSleep();
void addAppData(const QString &data); void addAppData(const QString &data);
QStringList appData() const; QStringList appData() const;

View File

@@ -13,8 +13,6 @@
"--socket=fallback-x11", "--socket=fallback-x11",
"--device=dri", "--device=dri",
"--share=ipc", "--share=ipc",
"--share=network",
"--socket=cups",
"--filesystem=host" "--filesystem=host"
], ],
"modules": [ "modules": [

View File

@@ -1,17 +1,17 @@
From 14f0685ddcf3a7d64bb85a3e9a9ac97c369bb508 Mon Sep 17 00:00:00 2001 From 2a390b5188fe070295090b1bd37273d12963b371 Mon Sep 17 00:00:00 2001
From: Laurent Trinques <scorpio@qelectrotech.org> From: Laurent Trinques <scorpio@qelectrotech.org>
Date: Sat, 26 Sep 2020 22:52:52 +0200 Date: Sat, 26 Sep 2020 22:52:52 +0200
Subject: [PATCH] build: Fix the installation paths Subject: [PATCH] build: Fix the installation paths
--- ---
qelectrotech.pro | 10 +++++----- qelectrotech.pro | 14 +++++++-------
1 file changed, 5 insertions(+), 5 deletions(-) 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/qelectrotech.pro b/qelectrotech.pro diff --git a/qelectrotech.pro b/qelectrotech.pro
index 7baddbb08..5dcda04b6 100644 index 2901a30d5..1019a9870 100644
--- a/qelectrotech.pro --- a/qelectrotech.pro
+++ b/qelectrotech.pro +++ b/qelectrotech.pro
@@ -5,18 +5,18 @@ @@ -5,20 +5,20 @@
# Chemins utilises pour la compilation et l'installation de QET # Chemins utilises pour la compilation et l'installation de QET
unix { unix {
# Chemins UNIX # Chemins UNIX
@@ -25,8 +25,12 @@ index 7baddbb08..5dcda04b6 100644
QET_LANG_PATH = 'share/qelectrotech/lang/' QET_LANG_PATH = 'share/qelectrotech/lang/'
QET_EXAMPLES_PATH = 'share/qelectrotech/examples/' QET_EXAMPLES_PATH = 'share/qelectrotech/examples/'
- QET_LICENSE_PATH = 'doc/qelectrotech/' - QET_LICENSE_PATH = 'doc/qelectrotech/'
- QET_MIME_XML_PATH = '../share/mime/application/'
- QET_MIME_DESKTOP_PATH = '../share/mimelnk/application/'
- QET_MIME_PACKAGE_PATH = '../share/mime/packages/' - QET_MIME_PACKAGE_PATH = '../share/mime/packages/'
+ QET_LICENSE_PATH = 'share/doc/qelectrotech/' + QET_LICENSE_PATH = 'share/doc/qelectrotech/'
+ QET_MIME_XML_PATH = 'share/mime/application/'
+ QET_MIME_DESKTOP_PATH = 'share/mimelnk/application/'
+ QET_MIME_PACKAGE_PATH = 'share/mime/packages/' + QET_MIME_PACKAGE_PATH = 'share/mime/packages/'
QET_DESKTOP_PATH = 'share/applications/' QET_DESKTOP_PATH = 'share/applications/'
QET_ICONS_PATH = 'share/icons/hicolor/' QET_ICONS_PATH = 'share/icons/hicolor/'
@@ -36,5 +40,5 @@ index 7baddbb08..5dcda04b6 100644
} }
win32 { win32 {
-- --
2.35.1 2.28.0

12
build-aux/snap/local/launchers/qelectrotech-launch Normal file → Executable file
View File

@@ -1,5 +1,17 @@
#!/bin/sh #!/bin/sh
# check if _only_ the correct framework snap is connected
framework_name=$(grep "name:" $SNAP/kf5/meta/snap.yaml | cut -d" " -f2)
if [ "$framework_name" != "kde-frameworks-5-qt-5-15-3-core20" ]; then
downloads_dir=$(xdg-user-dir DOWNLOAD)
test ! -d "$downloads_dir" && mkdir -p "$downloads_dir"
instructions_file="snap.qelectrotech.update-instructions.html"
target="$downloads_dir/$instructions_file"
cp "$SNAP/update-instructions/$instructions_file" "$target"
xdg-open "$target"
exit 1
fi
# migrate .qet directory from SNAP_USER_DATA to SNAP_USER_COMMON # migrate .qet directory from SNAP_USER_DATA to SNAP_USER_COMMON
from="$SNAP_USER_DATA/.qet" from="$SNAP_USER_DATA/.qet"
to="$SNAP_USER_COMMON/.qet" to="$SNAP_USER_COMMON/.qet"

File diff suppressed because one or more lines are too long

View File

@@ -56,6 +56,12 @@ parts:
organize: organize:
'*': bin/ '*': bin/
update-instructions:
plugin: dump
source: build-aux/snap/local/update-instructions
organize:
'*': update-instructions/
qet-tb-generator: qet-tb-generator:
plugin: python plugin: python
source: https://github.com/raulroda/qet_tb_generator-plugin.git source: https://github.com/raulroda/qet_tb_generator-plugin.git
@@ -76,7 +82,7 @@ parts:
- rsync - rsync
override-build: | 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-qt-5-15-3-core20-sdk/current/ /
dxf-to-qet: dxf-to-qet:
after: [kde-sdk-setup] after: [kde-sdk-setup]
plugin: nil plugin: nil
@@ -95,14 +101,16 @@ parts:
build-packages: build-packages:
- git - git
- libsqlite3-dev - libsqlite3-dev
override-build: | override-pull: |
snapcraftctl pull
displayed_version=$(grep "displayedVersion" sources/qet.h | tr -d "\";" | cut -d" " -f5) displayed_version=$(grep "displayedVersion" sources/qet.h | tr -d "\";" | cut -d" " -f5)
snap_version="${displayed_version}-g$(git rev-parse --short=8 HEAD)" snap_version="${displayed_version}~$(git rev-parse --short=8 HEAD)"
modified_displayed_version="${snap_version}.snap" modified_displayed_version="${snap_version}.snap"
sed -i -E "s|const QString displayedVersion =.*|const QString displayedVersion =\"$modified_displayed_version\";|" sources/qet.h sed -i -E "s|const QString displayedVersion =.*|const QString displayedVersion =\"$modified_displayed_version\";|" sources/qet.h
snapcraftctl set-version "$snap_version" snapcraftctl set-version "$snap_version"
override-build: |
qmake "$SNAPCRAFT_PART_SRC/qelectrotech.pro" qmake "$SNAPCRAFT_PART_SRC/qelectrotech.pro"
make -j${SNAPCRAFT_PARALLEL_BUILD_COUNT} make -j$(nproc)
make install INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL" make install INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL"
override-stage: | override-stage: |
snapcraftctl stage snapcraftctl stage

0
build-aux/windows/Lancer QET.bat Executable file → Normal file
View File

View File

@@ -47,6 +47,8 @@ endif()
endif() endif()
message("QET_LICENSE_PATH " ${QET_LICENSE_PATH}) message("QET_LICENSE_PATH " ${QET_LICENSE_PATH})
message("QET_MIME_XML_PATH " ${QET_MIME_XML_PATH})
message("QET_MIME_DESKTOP_PATH " ${QET_MIME_DESKTOP_PATH})
message("QET_MIME_PACKAGE_PATH " ${QET_MIME_PACKAGE_PATH}) message("QET_MIME_PACKAGE_PATH " ${QET_MIME_PACKAGE_PATH})
message("QET_DESKTOP_PATH " ${QET_DESKTOP_PATH}) message("QET_DESKTOP_PATH " ${QET_DESKTOP_PATH})
message("QET_ICONS_PATH " ${QET_ICONS_PATH}) message("QET_ICONS_PATH " ${QET_ICONS_PATH})

View File

@@ -28,6 +28,8 @@ if(UNIX AND NOT APPLE)
set(QET_LANG_PATH "share/qelectrotech/lang/") set(QET_LANG_PATH "share/qelectrotech/lang/")
set(QET_EXAMPLES_PATH "share/qelectrotech/examples/") set(QET_EXAMPLES_PATH "share/qelectrotech/examples/")
set(QET_LICENSE_PATH "doc/qelectrotech/") set(QET_LICENSE_PATH "doc/qelectrotech/")
set(QET_MIME_XML_PATH "../share/mime/application/")
set(QET_MIME_DESKTOP_PATH "../share/mimelnk/application/")
set(QET_MIME_PACKAGE_PATH "../share/mime/packages/") set(QET_MIME_PACKAGE_PATH "../share/mime/packages/")
set(QET_DESKTOP_PATH "share/applications/") set(QET_DESKTOP_PATH "share/applications/")
set(QET_ICONS_PATH "share/icons/hicolor/") set(QET_ICONS_PATH "share/icons/hicolor/")
@@ -45,6 +47,8 @@ if(APPLE)
set(QET_LANG_PATH "../Resources/lang/") set(QET_LANG_PATH "../Resources/lang/")
set(QET_EXAMPLES_PATH "share/qelectrotech/examples/") set(QET_EXAMPLES_PATH "share/qelectrotech/examples/")
set(QET_LICENSE_PATH "doc/qelectrotech/") set(QET_LICENSE_PATH "doc/qelectrotech/")
set(QET_MIME_XML_PATH "../share/mime/application/")
set(QET_MIME_DESKTOP_PATH "../share/mimelnk/application/")
set(QET_DESKTOP_PATH "share/applications/") set(QET_DESKTOP_PATH "share/applications/")
set(QET_ICONS_PATH "share/icons/hicolor/") set(QET_ICONS_PATH "share/icons/hicolor/")
set(QET_MAN_PATH "man/") set(QET_MAN_PATH "man/")

View File

@@ -1,20 +1,19 @@
<definition version="0.80" link_type="simple" hotspot_y="13" type="element" height="250" hotspot_x="15" width="30"> <definition version="0.80" link_type="simple" hotspot_y="13" type="element" height="250" hotspot_x="15" width="30">
<uuid uuid="{dd31e345-1749-fa3f-03f0-d2d4bce845bc}" /> <uuid uuid="{bb4c314c-2020-4c8a-b465-632eb562e1f7}"/>
<names> <names>
<name lang="fr">Cable</name> <name lang="fr">Cable</name>
<name lang="cs">Kabel</name> <name lang="cs">Kabel</name>
<name lang="de">Kabel</name> <name lang="hu">Kábel/name>
<name lang="hu">Kábel</name>
</names> </names>
<elementInformations /> <elementInformations/>
<informations /> <informations></informations>
<description> <description>
<rect ry="0" y="0" x="-10" style="line-style:normal;line-weight:normal;filling:none;color:black" height="230" rx="0" width="20" antialias="false" /> <rect ry="0" y="0" x="-10" style="line-style:normal;line-weight:normal;filling:none;color:black" height="230" rx="0" width="20" antialias="false"/>
<dynamic_text uuid="{3a1faa81-e74a-4640-af5a-3fb5c454f467}" rotation="270" text_width="-1" text_from="ElementInfo" font="Sans Serif,7,-1,5,50,0,0,0,0,0" frame="false" Valignment="AlignTop" y="200" x="-10" Halignment="AlignLeft" z="2"> <dynamic_text uuid="{3a1faa81-e74a-4640-af5a-3fb5c454f467}" rotation="270" text_width="-1" text_from="ElementInfo" font="Sans Serif,7,-1,5,50,0,0,0,0,0" frame="false" Valignment="AlignTop" y="200" x="-10" Halignment="AlignLeft" z="2">
<text /> <text></text>
<info_name>label</info_name> <info_name>label</info_name>
</dynamic_text> </dynamic_text>
<line x1="0" x2="0" end1="none" end2="none" y2="0" length1="1.5" y1="-4" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black" antialias="false" /> <line x1="0" x2="0" end1="none" end2="none" y2="0" length1="1.5" y1="-4" length2="1.5" style="line-style:normal;line-weight:normal;filling:none;color:black" antialias="false"/>
<terminal y="-4" x="0" orientation="n" /> <terminal y="-4" x="0" orientation="n"/>
</description> </description>
</definition> </definition>

Some files were not shown because too many files have changed in this diff Show More