Revamp terminalStrip feature code

Move RealTerminal class in a new file
Move PhysicalTerminal class in a new file.
Remove the use of QWeakPointer and use instead QSharedPointer
in a big part of the revamp.
This commit is contained in:
joshua
2021-12-26 17:26:00 +01:00
parent 2ea9f8a2c6
commit 5709f469fc
13 changed files with 844 additions and 799 deletions

View File

@@ -17,6 +17,8 @@
*/
#include "sortterminalstripcommand.h"
#include "../terminalstrip.h"
#include "../physicalterminal.h"
#include "../realterminal.h"
#include "../../utils/qetutils.h"
SortTerminalStripCommand::SortTerminalStripCommand(TerminalStrip *strip, QUndoCommand *parent) :
@@ -24,22 +26,22 @@ SortTerminalStripCommand::SortTerminalStripCommand(TerminalStrip *strip, QUndoCo
m_strip(strip)
{
setText(QObject::tr("Trier le bornier %1").arg(m_strip->name()));
m_old_order = QETUtils::weakVectorToShared(m_strip->physicalTerminal());
m_new_order = QETUtils::weakVectorToShared(m_strip->physicalTerminal());
m_old_order = m_strip->physicalTerminal();
m_new_order = m_strip->physicalTerminal();
sort();
}
void SortTerminalStripCommand::undo()
{
if (m_strip) {
m_strip->setOrderTo(QETUtils::sharedVectorToWeak(m_old_order));
m_strip->setOrderTo(m_old_order);
}
}
void SortTerminalStripCommand::redo()
{
if (m_strip) {
m_strip->setOrderTo(QETUtils::sharedVectorToWeak(m_new_order));
m_strip->setOrderTo(m_new_order);
}
}
@@ -56,7 +58,7 @@ void SortTerminalStripCommand::sort()
if (arg1->realTerminalCount())
{
str1 = arg1->realTerminals().constLast().toStrongRef()->label();
str1 = arg1->realTerminals().constLast()->label();
auto match = rx.match(str1);
if (match.hasMatch()) {
@@ -66,7 +68,7 @@ void SortTerminalStripCommand::sort()
if (arg2->realTerminalCount())
{
str2 = arg2->realTerminals().constLast().toStrongRef()->label();
str2 = arg2->realTerminals().constLast()->label();
auto match = rx.match(str2);
if (match.hasMatch()) {