Skip to content

Commit

Permalink
[CORRECTIVE] Combine wire and transactional ports views to one class.
Browse files Browse the repository at this point in the history
  • Loading branch information
hagantsa committed Mar 6, 2024
1 parent dbee90d commit d728e7d
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 135 deletions.
11 changes: 4 additions & 7 deletions Kactus2.pri
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ HEADERS += ./common/NameGenerationPolicy.h \
./editors/ComponentEditor/ports/WirePortsModel.h \
./editors/ComponentEditor/ports/WirePortsFilter.h \
./editors/ComponentEditor/ports/WirePortsDelegate.h \
./editors/ComponentEditor/ports/WirePortsView.h \
./editors/ComponentEditor/ports/TypedPortsView.h \
./editors/ComponentEditor/ports/portsdelegate.h \
./editors/ComponentEditor/ports/portseditor.h \
./editors/ComponentEditor/ports/portsmodel.h \
Expand Down Expand Up @@ -895,9 +895,7 @@ HEADERS += ./common/NameGenerationPolicy.h \
./PythonAPI/FileChannel.h \
./PythonAPI/PythonInterpreter.h \
./PythonAPI/StdInputListener.h \
./PythonAPI/extensions/IOCatcher.h \
./editors/MemoryDesigner/MemoryItemConstants.h
./editors/ComponentEditor/ports/TransactionalPortsView.h
./PythonAPI/extensions/IOCatcher.h
SOURCES += ./editors/ComponentEditor/busInterfaces/general/MasterModeEditor.cpp \
./common/GenericEditProvider.cpp \
./common/NameGenerationPolicy.cpp \
Expand Down Expand Up @@ -1219,7 +1217,7 @@ SOURCES += ./editors/ComponentEditor/busInterfaces/general/MasterModeEditor.cpp
./editors/ComponentEditor/ports/WirePortsEditorFactory.cpp \
./editors/ComponentEditor/ports/WirePortsFilter.cpp \
./editors/ComponentEditor/ports/WirePortsModel.cpp \
./editors/ComponentEditor/ports/WirePortsView.cpp \
./editors/ComponentEditor/ports/TypedPortsView.cpp \
./editors/ComponentEditor/views/envidentifiereditor.cpp \
./editors/ComponentEditor/views/envidentifiersmodel.cpp \
./editors/ComponentEditor/views/vieweditor.cpp \
Expand Down Expand Up @@ -1686,6 +1684,5 @@ SOURCES += ./editors/ComponentEditor/busInterfaces/general/MasterModeEditor.cpp
./PythonAPI/FileChannel.cpp \
./PythonAPI/PythonInterpreter.cpp \
./PythonAPI/StdInputListener.cpp \
./PythonAPI/extensions/IOCatcher.cpp \
./editors/ComponentEditor/ports/TransactionalPortsView.cpp
./PythonAPI/extensions/IOCatcher.cpp
RESOURCES += kactus.qrc
6 changes: 2 additions & 4 deletions Kactus2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -690,13 +690,12 @@ CreateHelp
<ClCompile Include="editors\ComponentEditor\ports\TransactionalPortsEditorFactory.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\TransactionalPortsFilter.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\TransactionalPortsModel.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\TransactionalPortsView.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\TypedPortEditor.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\WirePortsDelegate.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\WirePortsEditorFactory.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\WirePortsFilter.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\WirePortsModel.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\WirePortsView.cpp" />
<ClCompile Include="editors\ComponentEditor\ports\TypedPortsView.cpp" />
<ClCompile Include="editors\ComponentEditor\powerDomains\PowerDomainsDelegate.cpp" />
<ClCompile Include="editors\ComponentEditor\powerDomains\PowerDomainsEditor.cpp" />
<ClCompile Include="editors\ComponentEditor\powerDomains\PowerDomainsModel.cpp" />
Expand Down Expand Up @@ -1876,7 +1875,6 @@ CreateHelp
</QtMoc>
<QtMoc Include="editors\ComponentEditor\ports\TypedPortEditor.h" />
<ClInclude Include="editors\ComponentEditor\ports\TransactionalPortsEditorFactory.h" />
<QtMoc Include="editors\ComponentEditor\ports\TransactionalPortsView.h" />
<ClInclude Include="editors\ComponentEditor\ports\WirePortColumns.h" />
<QtMoc Include="editors\ComponentEditor\ports\WirePortsModel.h">
</QtMoc>
Expand All @@ -1887,7 +1885,7 @@ CreateHelp
<QtMoc Include="editors\ComponentEditor\powerDomains\PowerDomainsEditor.h" />
<QtMoc Include="editors\ComponentEditor\powerDomains\PowerDomainsModel.h" />
<ClInclude Include="editors\ComponentEditor\ports\WirePortsEditorFactory.h" />
<QtMoc Include="editors\ComponentEditor\ports\WirePortsView.h" />
<QtMoc Include="editors\ComponentEditor\ports\TypedPortsView.h" />
<ClInclude Include="editors\ComponentEditor\powerDomains\PowerDomainColumns.h" />
<QtMoc Include="editors\ComponentEditor\powerDomains\PowerDomainsDelegate.h" />
<ClInclude Include="editors\ComponentEditor\remapStates\RemapConditionColumns.h" />
Expand Down
6 changes: 2 additions & 4 deletions Kactus2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -3364,10 +3364,9 @@
<ClCompile Include="library\VLNVDialer\RevisionGroup.cpp">
<Filter>Source Files\library\VLNVDialer</Filter>
</ClCompile>
<ClCompile Include="editors\ComponentEditor\ports\WirePortsView.cpp">
<Filter>Source Files\editors\ComponentEditor\ports</Filter>
</ClCompile>
<ClCompile Include="editors\ComponentEditor\ports\TransactionalPortsView.cpp">
<ClCompile Include="editors\ComponentEditor\ports\TypedPortsView.cpp">
<Filter>Source Files\editors\ComponentEditor\ports</Filter>
</ClCompile>
</ItemGroup>
Expand Down Expand Up @@ -6083,10 +6082,9 @@
<QtMoc Include="library\VLNVDialer\RevisionGroup.h">
<Filter>Header Files\library\VLNVDialer</Filter>
</QtMoc>
<QtMoc Include="editors\ComponentEditor\ports\WirePortsView.h">
<Filter>Header Files\editors\ComponentEditor\ports</Filter>
</QtMoc>
<QtMoc Include="editors\ComponentEditor\ports\TransactionalPortsView.h">
<QtMoc Include="editors\ComponentEditor\ports\TypedPortsView.h">
<Filter>Header Files\editors\ComponentEditor\ports</Filter>
</QtMoc>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "TransactionalPortsEditorFactory.h"

#include <editors/ComponentEditor/ports/TransactionalPortsView.h>
#include <editors/ComponentEditor/ports/TypedPortsView.h>
#include <editors/ComponentEditor/ports/TransactionalPortColumns.h>
#include <editors/ComponentEditor/ports/TransactionalPortsFilter.h>
#include <editors/ComponentEditor/ports/TransactionalPortsDelegate.h>
Expand Down Expand Up @@ -44,7 +44,8 @@ PortsFilter* TransactionalPortsEditorFactory::createFilter(QObject* parent) cons
//-----------------------------------------------------------------------------
PortsView* TransactionalPortsEditorFactory::createView(QWidget* parent) const
{
auto view = new TransactionalPortsView(TransactionalPortColumns::NAME, busInterface_, parent);
auto view = new TypedPortsView(TransactionalPortColumns::TYPE_NAME, TransactionalPortColumns::NAME,
busInterface_, parent);

view->setDefaultImportExportPath(defaultPath_);
view->setAllowImportExport(true);
Expand Down
52 changes: 0 additions & 52 deletions editors/ComponentEditor/ports/TransactionalPortsView.cpp

This file was deleted.

37 changes: 0 additions & 37 deletions editors/ComponentEditor/ports/TransactionalPortsView.h

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
//-----------------------------------------------------------------------------
// File: WirePortsView.cpp
// File: TypedPortsView.cpp
//-----------------------------------------------------------------------------
// Project: Kactus 2
// Author: Anton Hagqvist
// Date: 16.02.2024
//
// Description:
// View for wire ports editor.
// View for typed ports editors.
//-----------------------------------------------------------------------------

#include "WirePortsView.h"

#include "WirePortColumns.h"
#include "TypedPortsView.h"

#include <QApplication>
#include <QClipboard>
#include <QMimeData>

//-----------------------------------------------------------------------------
// Function: WirePortsView::onCopyAction()
// Function: TypedPortsView::TypedPortsView()
//-----------------------------------------------------------------------------
TypedPortsView::TypedPortsView(int typeColumn, int nameColumn, BusInterfaceInterface* busInterface, QWidget* parent) :
PortsView(nameColumn, busInterface, parent),
typeColumn_(typeColumn)
{

}

//-----------------------------------------------------------------------------
// Function: TypedPortsView::onCopyAction()
//-----------------------------------------------------------------------------
void WirePortsView::onCopyAction()
void TypedPortsView::onCopyAction()
{
if (!currentIndex().isValid() || currentIndex().column() != WirePortColumns::TYPE_NAME ||
if (!currentIndex().isValid() || currentIndex().column() != typeColumn_ ||
selectedIndexes().size() != 1)
{
PortsView::onCopyAction();
Expand All @@ -36,11 +44,11 @@ void WirePortsView::onCopyAction()
}

//-----------------------------------------------------------------------------
// Function: WirePortsView::onPasteAction()
// Function: TypedPortsView::onPasteAction()
//-----------------------------------------------------------------------------
void WirePortsView::onPasteAction()
void TypedPortsView::onPasteAction()
{
if (!currentIndex().isValid() || currentIndex().column() != WirePortColumns::TYPE_NAME ||
if (!currentIndex().isValid() || currentIndex().column() != typeColumn_ ||
selectedIndexes().size() != 1)
{
PortsView::onPasteAction();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,44 @@
//-----------------------------------------------------------------------------
// File: WirePortsView.h
// File: TypedPortsView.h
//-----------------------------------------------------------------------------
// Project: Kactus 2
// Author: Anton Hagqvist
// Date: 16.02.2024
//
// Description:
// View for wire ports editor.
// View for typed ports editors.
//-----------------------------------------------------------------------------

#ifndef WIREPORTSVIEW_H
#define WIREPORTSVIEW_H
#ifndef TYPEDPORTSVIEW_H
#define TYPEDPORTSVIEW_H

#include "PortsView.h"

class WirePortsView : public PortsView
class BusInterfaceInterface;

class TypedPortsView : public PortsView
{
Q_OBJECT
public:

// Use base class constructor.
using PortsView::PortsView;
TypedPortsView(int typeColumn, int nameColumn, BusInterfaceInterface* busInterface, QWidget* parent);

virtual ~WirePortsView() = default;
virtual ~TypedPortsView() = default;

private slots:

//! Handler for copy action.
void onCopyAction() override;
virtual void onCopyAction() override;

//! Handler for paste action
virtual void onPasteAction() override;

private:

//! The number of the column containing the type definitions information.
int typeColumn_;
};

#endif // WIREPORTSVIEW_H
#endif // TYPEDPORTSVIEW_H

4 changes: 2 additions & 2 deletions editors/ComponentEditor/ports/WirePortsEditorFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#include "WirePortsEditorFactory.h"

#include <editors/ComponentEditor/ports/WirePortsView.h>
#include <editors/ComponentEditor/ports/TypedPortsView.h>
#include <editors/ComponentEditor/ports/WirePortsModel.h>
#include <editors/ComponentEditor/ports/WirePortColumns.h>
#include <editors/ComponentEditor/ports/WirePortsFilter.h>
Expand Down Expand Up @@ -45,7 +45,7 @@ PortsFilter* WirePortsEditorFactory::createFilter(QObject* parent) const
//-----------------------------------------------------------------------------
PortsView* WirePortsEditorFactory::createView(QWidget* parent) const
{
auto view = new WirePortsView(WirePortColumns::NAME, busInterface_, parent);
auto view = new TypedPortsView(WirePortColumns::TYPE_NAME, WirePortColumns::NAME, busInterface_, parent);

view->setDefaultImportExportPath(defaultPath_);
view->setAllowImportExport(true);
Expand Down
14 changes: 7 additions & 7 deletions version.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@
#ifndef VERSIONNO__H
#define VERSIONNO__H

#define VERSION_FULL 3.13.260.0
#define VERSION_FULL 3.13.262.0

#define VERSION_BASEYEAR 0
#define VERSION_DATE "2024-03-06"
#define VERSION_TIME "11:04:32"
#define VERSION_TIME "12:38:20"

#define VERSION_MAJOR 3
#define VERSION_MINOR 13
#define VERSION_BUILDNO 260
#define VERSION_BUILDNO 262
#define VERSION_EXTEND 0

#define VERSION_FILE 3,13,260,0
#define VERSION_PRODUCT 3,13,260,0
#define VERSION_FILESTR "3,13,260,0"
#define VERSION_PRODUCTSTR "3,13,260,0"
#define VERSION_FILE 3,13,262,0
#define VERSION_PRODUCT 3,13,262,0
#define VERSION_FILESTR "3,13,262,0"
#define VERSION_PRODUCTSTR "3,13,262,0"

#endif

0 comments on commit d728e7d

Please sign in to comment.