Skip to content
This repository has been archived by the owner on Jul 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from helios-base/develop
Browse files Browse the repository at this point in the history
Support the json format. replace boost with std
  • Loading branch information
hidehisaakiyama authored Apr 7, 2022
2 parents 6bf10e8 + 72f54e6 commit 3b3df8f
Show file tree
Hide file tree
Showing 20 changed files with 1,237 additions and 1,172 deletions.
26 changes: 16 additions & 10 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ bin_PROGRAMS = fedit2
fedit2_SOURCES = \
command.cpp \
config_dialog.cpp \
constraint_delegate.cpp \
constraint_edit_dialog.cpp \
constraint_view.cpp \
coordinate_delegate.cpp \
edit_canvas.cpp \
edit_data.cpp \
Expand All @@ -17,13 +14,16 @@ fedit2_SOURCES = \
options.cpp \
main.cpp


# constraint_delegate.cpp
# constraint_edit_dialog.cpp
# constraint_view.cpp


noinst_HEADERS = \
mouse_state.h \
command.h \
config_dialog.h \
constraint_delegate.h \
constraint_edit_dialog.h \
constraint_view.h \
coordinate_delegate.h \
edit_canvas.h \
edit_data.h \
Expand All @@ -32,20 +32,26 @@ noinst_HEADERS = \
main_window.h \
options.h

# constraint_delegate.h
# constraint_edit_dialog.h
# constraint_view.h


nodist_fedit2_SOURCES = \
moc_config_dialog.cpp \
moc_constraint_delegate.cpp \
moc_constraint_edit_dialog.cpp \
moc_constraint_view.cpp \
moc_coordinate_delegate.cpp \
moc_edit_dialog.cpp \
moc_edit_canvas.cpp \
moc_sample_view.cpp \
moc_main_window.cpp

# moc_constraint_delegate.cpp
# moc_constraint_edit_dialog.cpp
# moc_constraint_view.cpp


fedit2_CPPFLAGS = -I$(top_srcdir) $(QT_CPPFLAGS)
fedit2_CXXFLAGS = $(QT_CXXFLAGS) -Wall -W
fedit2_CXXFLAGS = $(QT_CXXFLAGS) -Wall -W -Wno-deprecated-copy
fedit2_LDFLAGS = $(QT_LDFLAGS)
fedit2_LDADD = $(QT_LDADD)

Expand Down
6 changes: 3 additions & 3 deletions src/constraint_edit_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
*/
ConstraintEditDialog::ConstraintEditDialog( QWidget * parent,
EditCanvas * canvas,
boost::shared_ptr< EditData > data,
std::shared_ptr< EditData > data,
const int origin_index,
const int terminal_index )
: QDialog( parent )
Expand Down Expand Up @@ -123,14 +123,14 @@ ConstraintEditDialog::createWidgets()

//
M_origin = new QSpinBox();
M_origin->setRange( 1, M_edit_data->samples()->dataCont().size() );
M_origin->setRange( 1, M_edit_data->formationData()->dataCont().size() );
M_origin->setWrapping( true );
connect( M_origin, SIGNAL( valueChanged( int ) ),
this, SLOT( changeIndex() ) );
layout->addWidget( M_origin, 1, 0 );
//
M_terminal = new QSpinBox();
M_terminal->setRange( 1, M_edit_data->samples()->dataCont().size() );
M_terminal->setRange( 1, M_edit_data->formationData()->dataCont().size() );
M_terminal->setWrapping( true );
connect( M_terminal, SIGNAL( valueChanged( int ) ),
this, SLOT( changeIndex() ) );
Expand Down
6 changes: 3 additions & 3 deletions src/constraint_edit_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <QDialog>

#include <boost/shared_ptr.hpp>
#include <memory>

class EditCanvas;
class EditData;
Expand All @@ -53,7 +53,7 @@ class ConstraintEditDialog
private:

EditCanvas * M_edit_canvas;
boost::shared_ptr< EditData > M_edit_data;
std::shared_ptr< EditData > M_edit_data;

QSpinBox * M_origin;
QSpinBox * M_terminal;
Expand All @@ -66,7 +66,7 @@ class ConstraintEditDialog

ConstraintEditDialog( QWidget * parent,
EditCanvas * canvas,
boost::shared_ptr< EditData > data,
std::shared_ptr< EditData > data,
const int origin_index,
const int terminal_index );
~ConstraintEditDialog();
Expand Down
20 changes: 9 additions & 11 deletions src/constraint_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ ConstraintView::~ConstraintView()
void
ConstraintView::updateData()
{
boost::shared_ptr< EditData > ptr = M_edit_data.lock();
std::shared_ptr< EditData > ptr = M_edit_data.lock();
if ( ! ptr
|| ! ptr->samples() )
|| ! ptr->formationData() )
{
M_origin_delegate->setRange( 0, 0 );
M_terminal_delegate->setRange( 0, 0 );
Expand All @@ -127,9 +127,9 @@ ConstraintView::updateData()
// update range
//

if ( ! ptr->samples()->constraints().empty() )
if ( ! ptr->formationData()->constraints().empty() )
{
int maximum = ptr->samples()->dataCont().size();
int maximum = ptr->formationData()->dataCont().size();
M_origin_delegate->setRange( 1, maximum );
M_terminal_delegate->setRange( 1, maximum );
}
Expand All @@ -138,18 +138,15 @@ ConstraintView::updateData()
// update constraints
//

const int data_count = ptr->samples()->constraints().size();
const int data_count = ptr->formationData()->constraints().size();

while ( this->rowCount() > data_count )
{
this->removeRow( this->rowCount() - 1 );
}

int idx = 0;
const rcsc::formation::SampleDataSet::Constraints::const_iterator end = ptr->samples()->constraints().end();
for ( rcsc::formation::SampleDataSet::Constraints::const_iterator it = ptr->samples()->constraints().begin();
it != end;
++it, ++idx )
for ( const rcsc::FormationData::Constraint & c : ptr->formationData()->constraints() )
{
QTableWidgetItem * item = this->item( idx, 0 );
if ( ! item )
Expand All @@ -164,7 +161,7 @@ ConstraintView::updateData()
this->setItem( idx, col, item );
++col;

item = new QTableWidgetItem( QString::number( it->first->index_ + 1 ) );
item = new QTableWidgetItem( QString::number( c.first->index_ + 1 ) );
item->setFlags( Qt::ItemIsSelectable
| Qt::ItemIsEditable
| Qt::ItemIsDragEnabled
Expand All @@ -175,7 +172,7 @@ ConstraintView::updateData()
this->setItem( idx, col, item );
++col;

item = new QTableWidgetItem( QString::number( it->second->index_ + 1 ) );
item = new QTableWidgetItem( QString::number( c.second->index_ + 1 ) );
item->setFlags( Qt::ItemIsSelectable
| Qt::ItemIsEditable
| Qt::ItemIsDragEnabled
Expand All @@ -186,6 +183,7 @@ ConstraintView::updateData()
this->setItem( idx, col, item );
++col;
}
++idx;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/constraint_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#include <QTableWidget>

#include <boost/weak_ptr.hpp>
#include <memory>

class ConstraintDelegate;
class EditData;
Expand All @@ -46,7 +46,7 @@ class ConstraintView

private:

boost::weak_ptr< EditData > M_edit_data;
std::weak_ptr< EditData > M_edit_data;

ConstraintDelegate * M_origin_delegate;
ConstraintDelegate * M_terminal_delegate;
Expand All @@ -56,7 +56,7 @@ class ConstraintView
ConstraintView( QWidget * parent = 0 );
~ConstraintView();

void setData( boost::shared_ptr< EditData > ptr )
void setData( std::shared_ptr< EditData > ptr )
{
M_edit_data = ptr;
}
Expand Down
Loading

0 comments on commit 3b3df8f

Please sign in to comment.