Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
darktorres committed Oct 27, 2022
1 parent 6dbff2b commit 1f19ddf
Show file tree
Hide file tree
Showing 38 changed files with 44 additions and 43 deletions.
2 changes: 1 addition & 1 deletion app/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Application::Application(int &argc, char **argv)

bool Application::notify(QObject *receiver, QEvent *event)
{
bool done;
bool done = false;

try {
done = QApplication::notify(receiver, event);
Expand Down
2 changes: 1 addition & 1 deletion app/arduino/codegenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <QRegularExpression>

#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
using Qt::endl;
#define endl Qt::endl
#endif

CodeGenerator::CodeGenerator(const QString &fileName, const QVector<GraphicElement *> &elements)
Expand Down
8 changes: 4 additions & 4 deletions app/bewaveddolphin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,10 +876,10 @@ void BewavedDolphin::copy(const QItemSelection &ranges, QDataStream &stream)
for (const auto &item : itemList) {
const int row = item.row();
const int col = item.column();
const int data = m_model->index(row, col).data().toInt();
const int data_ = m_model->index(row, col).data().toInt();
stream << static_cast<qint64>(row - firstRow);
stream << static_cast<qint64>(col - firstCol);
stream << static_cast<qint64>(data);
stream << static_cast<qint64>(data_);
}
}

Expand Down Expand Up @@ -940,12 +940,12 @@ void BewavedDolphin::paste(const QItemSelection &ranges, QDataStream &stream)
for (int i = 0; i < static_cast<int>(itemListSize); ++i) {
quint64 row; stream >> row;
quint64 col; stream >> col;
quint64 data; stream >> data;
quint64 data_; stream >> data_;
const int newRow = static_cast<int>(firstRow + row);
const int newCol = static_cast<int>(firstCol + col);

if ((newRow < m_inputPorts) && (newCol < m_model->columnCount())) {
createElement(newRow, newCol, static_cast<int>(data));
createElement(newRow, newCol, static_cast<int>(data_));
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/element/and.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<And>();
int id = qRegisterMetaType<And>();
}

And::And(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/buzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

namespace
{
int id = qRegisterMetaType<Buzzer>();
int id = qRegisterMetaType<Buzzer>();
}

Buzzer::Buzzer(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/clock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ using namespace std::chrono_literals;

namespace
{
int id = qRegisterMetaType<Clock>();
int id = qRegisterMetaType<Clock>();
}

Clock::Clock(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/demux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<Demux>();
int id = qRegisterMetaType<Demux>();
}

Demux::Demux(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/dflipflop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<DFlipFlop>();
int id = qRegisterMetaType<DFlipFlop>();
}

DFlipFlop::DFlipFlop(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/display_14.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace
{
int id = qRegisterMetaType<Display14>();
int id = qRegisterMetaType<Display14>();
}

Display14::Display14(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/display_7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

namespace
{
int id = qRegisterMetaType<Display7>();
int id = qRegisterMetaType<Display7>();
}

Display7::Display7(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/dlatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<DLatch>();
int id = qRegisterMetaType<DLatch>();
}

DLatch::DLatch(QGraphicsItem *parent)
Expand Down
1 change: 0 additions & 1 deletion app/element/element.pri
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ HEADERS += \
$$PWD/display_14.h \
$$PWD/display_7.h \
$$PWD/dlatch.h \
$$PWD/graphicelementinput.h \
$$PWD/inputbutton.h \
$$PWD/inputgnd.h \
$$PWD/inputrotary.h \
Expand Down
2 changes: 1 addition & 1 deletion app/element/inputbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace
{
int id = qRegisterMetaType<InputButton>();
int id = qRegisterMetaType<InputButton>();
}

InputButton::InputButton(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/inputgnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<InputGnd>();
int id = qRegisterMetaType<InputGnd>();
}

InputGnd::InputGnd(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/inputrotary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace
{
int id = qRegisterMetaType<InputRotary>();
int id = qRegisterMetaType<InputRotary>();
}

InputRotary::InputRotary(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/inputswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace
{
int id = qRegisterMetaType<InputSwitch>();
int id = qRegisterMetaType<InputSwitch>();
}

InputSwitch::InputSwitch(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/inputvcc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<InputVcc>();
int id = qRegisterMetaType<InputVcc>();
}

InputVcc::InputVcc(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/jkflipflop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<JKFlipFlop>();
int id = qRegisterMetaType<JKFlipFlop>();
}

JKFlipFlop::JKFlipFlop(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/led.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace
{
int id = qRegisterMetaType<Led>();
int id = qRegisterMetaType<Led>();
}

Led::Led(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<Line>();
int id = qRegisterMetaType<Line>();
}

Line::Line(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/mux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<Mux>();
int id = qRegisterMetaType<Mux>();
}

Mux::Mux(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/nand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<Nand>();
int id = qRegisterMetaType<Nand>();
}

Nand::Nand(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<Node>();
int id = qRegisterMetaType<Node>();
}

Node::Node(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/nor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<Nor>();
int id = qRegisterMetaType<Nor>();
}

Nor::Nor(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/not.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<Not>();
int id = qRegisterMetaType<Not>();
}

Not::Not(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/or.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<Or>();
int id = qRegisterMetaType<Or>();
}

Or::Or(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/srflipflop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<SRFlipFlop>();
int id = qRegisterMetaType<SRFlipFlop>();
}

SRFlipFlop::SRFlipFlop(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<Text>();
int id = qRegisterMetaType<Text>();
}

Text::Text(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/tflipflop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace
{
int id = qRegisterMetaType<TFlipFlop>();
int id = qRegisterMetaType<TFlipFlop>();
}

TFlipFlop::TFlipFlop(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/xnor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<Xnor>();
int id = qRegisterMetaType<Xnor>();
}

Xnor::Xnor(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/element/xor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace
{
int id = qRegisterMetaType<Xor>();
int id = qRegisterMetaType<Xor>();
}

Xor::Xor(QGraphicsItem *parent)
Expand Down
4 changes: 2 additions & 2 deletions app/elementlabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ void ElementLabel::startDrag()
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
QPoint offset = m_iconLabel.pixmap()->rect().center();
#else
QPoint offset = m_iconLabel.pixmap().rect().center();
QPoint offset = m_iconLabel.pixmap(Qt::ReturnByValue).rect().center();
#endif
QByteArray itemData;
QDataStream stream(&itemData, QIODevice::WriteOnly);
Expand All @@ -103,7 +103,7 @@ QMimeData *ElementLabel::mimeData()
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
QPoint offset = m_iconLabel.pixmap()->rect().center();
#else
QPoint offset = m_iconLabel.pixmap().rect().center();
QPoint offset = m_iconLabel.pixmap(Qt::ReturnByValue).rect().center();
#endif
QByteArray itemData;
QDataStream stream(&itemData, QIODevice::WriteOnly);
Expand Down
4 changes: 2 additions & 2 deletions app/graphicelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

namespace
{
int id = qRegisterMetaType<GraphicElement>();
int id = qRegisterMetaType<GraphicElement>();
}

const int maximumValidInputSize = 256;
Expand Down Expand Up @@ -302,7 +302,7 @@ void GraphicElement::loadNewFormat(QDataStream &stream, QMap<quint64, QNEPort *>
if (port < m_inputPorts.size()) {
m_inputPorts.value(port)->setPtr(ptr);

if (ElementType() == ElementType::IC) {
if (elementType() == ElementType::IC) {
m_inputPorts.value(port)->setName(name);
}
} else {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion app/ic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace
{
int id = qRegisterMetaType<IC>();
int id = qRegisterMetaType<IC>();
}

IC::IC(QGraphicsItem *parent)
Expand Down
2 changes: 1 addition & 1 deletion app/nodes/qneconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

namespace
{
int id = qRegisterMetaType<QNEConnection>();
int id = qRegisterMetaType<QNEConnection>();
}

QNEConnection::QNEConnection(QGraphicsItem *parent)
Expand Down
4 changes: 2 additions & 2 deletions app/nodes/qneport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@

namespace
{
int id = qRegisterMetaType<QNEInputPort>();
int id2 = qRegisterMetaType<QNEOutputPort>();
int id = qRegisterMetaType<QNEInputPort>();
int id2 = qRegisterMetaType<QNEOutputPort>();
}

QNEPort::QNEPort(QGraphicsItem *parent)
Expand Down
4 changes: 3 additions & 1 deletion config.pri
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ linux {
}

msvc {
QMAKE_CXXFLAGS += /permissive-
QMAKE_CXXFLAGS_WARN_ON ~= s/-W3/-W4
QMAKE_CXXFLAGS += /permissive- /external:I $$[QT_INSTALL_PREFIX] /external:W0
QMAKE_CXXFLAGS_DEBUG += /Ob1
QMAKE_CXXFLAGS_RELEASE += /GL
QMAKE_LFLAGS_RELEASE += /LTCG
Expand Down Expand Up @@ -151,6 +152,7 @@ HEADERS += \
$$PWD/app/enums.h \
$$PWD/app/globalproperties.h \
$$PWD/app/graphicelement.h \
$$PWD/app/graphicelementinput.h \
$$PWD/app/graphicsview.h \
$$PWD/app/ic.h \
$$PWD/app/itemwithid.h \
Expand Down

0 comments on commit 1f19ddf

Please sign in to comment.