mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
QT6: Todo Fix QtConcurrent (remove KCoreAddons?)
This commit is contained in:
@@ -16,11 +16,6 @@
|
|||||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <utility>
|
|
||||||
#include <QtConcurrent>
|
|
||||||
#include <QHash>
|
|
||||||
|
|
||||||
#include "qetproject.h"
|
#include "qetproject.h"
|
||||||
#include "diagram.h"
|
#include "diagram.h"
|
||||||
@@ -37,6 +32,13 @@
|
|||||||
#include "numerotationcontextcommands.h"
|
#include "numerotationcontextcommands.h"
|
||||||
#include "assignvariables.h"
|
#include "assignvariables.h"
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <utility>
|
||||||
|
#include <QtConcurrent>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QtDebug>
|
||||||
|
|
||||||
static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
|
static int BACKUP_INTERVAL = 120000; //interval in ms of backup = 2min
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -178,7 +180,7 @@ QETProject::ProjectState QETProject::openFile(QFile *file)
|
|||||||
bool opened_here = file->isOpen() ? false : true;
|
bool opened_here = file->isOpen() ? false : true;
|
||||||
if (!file->isOpen()
|
if (!file->isOpen()
|
||||||
&& !file->open(QIODevice::ReadOnly
|
&& !file->open(QIODevice::ReadOnly
|
||||||
| QIODevice::Text)) {
|
| QIODevice::Text)) {
|
||||||
return FileOpenFailed;
|
return FileOpenFailed;
|
||||||
}
|
}
|
||||||
QFileInfo fi(*file);
|
QFileInfo fi(*file);
|
||||||
@@ -887,7 +889,7 @@ QDomDocument QETProject::toXml()
|
|||||||
for(Diagram *diagram : diagrams_list)
|
for(Diagram *diagram : diagrams_list)
|
||||||
{
|
{
|
||||||
qDebug() << QString("exporting diagram \"%1\""
|
qDebug() << QString("exporting diagram \"%1\""
|
||||||
).arg(diagram -> title())
|
).arg(diagram -> title())
|
||||||
<< "["
|
<< "["
|
||||||
<< diagram
|
<< diagram
|
||||||
<< "]";
|
<< "]";
|
||||||
@@ -1080,7 +1082,7 @@ ElementsLocation QETProject::importElement(ElementsLocation &location)
|
|||||||
//Element doesn't exist in the collection, we just import it
|
//Element doesn't exist in the collection, we just import it
|
||||||
else {
|
else {
|
||||||
ElementsLocation loc(m_elements_collection->addElement(
|
ElementsLocation loc(m_elements_collection->addElement(
|
||||||
location), this);
|
location), this);
|
||||||
|
|
||||||
if (!loc.exist()) {
|
if (!loc.exist()) {
|
||||||
qDebug() << "failed to import location. "
|
qDebug() << "failed to import location. "
|
||||||
@@ -1370,8 +1372,8 @@ void QETProject::readDiagramsXml(QDomDocument &xml_project)
|
|||||||
|
|
||||||
int diagram_order = -1;
|
int diagram_order = -1;
|
||||||
if (!QET::attributeIsAnInteger(diagram_xml_element,
|
if (!QET::attributeIsAnInteger(diagram_xml_element,
|
||||||
"order",
|
"order",
|
||||||
&diagram_order))
|
&diagram_order))
|
||||||
diagram_order = 500000;
|
diagram_order = 500000;
|
||||||
|
|
||||||
addDiagram(diagram, diagram_order-1);
|
addDiagram(diagram, diagram_order-1);
|
||||||
@@ -1691,11 +1693,16 @@ NamesList QETProject::namesListForIntegrationCategory()
|
|||||||
*/
|
*/
|
||||||
void QETProject::writeBackup()
|
void QETProject::writeBackup()
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove
|
||||||
QDomDocument xml_project(toXml());
|
QDomDocument xml_project(toXml());
|
||||||
QtConcurrent::run(QET::writeToFile,
|
QtConcurrent::run(
|
||||||
xml_project,
|
QET::writeToFile,xml_project,&m_backup_file,nullptr);
|
||||||
&m_backup_file,
|
#else
|
||||||
nullptr);
|
#if TODO_LIST
|
||||||
|
#pragma message("@TODO remove code for QT 6 or later")
|
||||||
|
#endif
|
||||||
|
qDebug()<<"Help code for QT 6 or later";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user