Skip to content

Commit

Permalink
Drop image instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
hrobeers committed Mar 26, 2014
1 parent a45befc commit 51798eb
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
5 changes: 3 additions & 2 deletions src/foileditors/outlineeditor/outlineeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ OutlineEditor::OutlineEditor(Foil *foil, QWidget *parent) :
//
// PathEditors
//
QFlags<Features::e> features(Features::HorizontalAxis | Features::DropImageHereText);
_topPathEditor = new patheditor::PathEditorWidget();
_topPathEditor->enableFeatures(Features::HorizontalAxis);
_topPathEditor->enableFeatures(features);
_botPathEditor = new patheditor::PathEditorWidget();
_botPathEditor->enableFeatures(Features::HorizontalAxis);
_botPathEditor->enableFeatures(features);


//
Expand Down
2 changes: 1 addition & 1 deletion src/foileditors/profileeditor/profileeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ProfileEditor::ProfileEditor(Foil* foil, QWidget *parent) :
QWidget(parent)
{
_pathEditor = new patheditor::PathEditorWidget();
_pathEditor->enableFeatures(Features::HorizontalAxis);
_pathEditor->enableFeatures(QFlags<Features::e>(Features::HorizontalAxis | Features::DropImageHereText));

QComboBox* symmetryCombo = new QComboBox();
symmetryCombo->addItem(tr("Symmetric"));
Expand Down
4 changes: 2 additions & 2 deletions src/foileditors/thicknesseditor/thicknesseditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ ThicknessEditor::ThicknessEditor(Foil *foil, QWidget *parent) :
QWidget(parent)
{
_pathEditor = new patheditor::PathEditorWidget();
_pathEditor->enableFeatures(Features::HorizontalAxis);
_pathEditor->enableFeatures(Features::VerticalAxis);
_pathEditor->enableFeatures(QFlags<Features::e>(Features::HorizontalAxis | Features::VerticalAxis |
Features::DropImageHereText));

QGroupBox* gb = new QGroupBox(tr("Thickness"));
QVBoxLayout* gbLayout = new QVBoxLayout();
Expand Down
19 changes: 13 additions & 6 deletions src/patheditor/patheditorwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,31 @@ void PathEditorWidget::clear()

void PathEditorWidget::enableFeatures(QFlags<Features::e> features)
{
if (Features::HorizontalAxis == (Features::HorizontalAxis & features) &&
Features::HorizontalAxis != (Features::HorizontalAxis & _enabledFeatures))
if (features.testFlag(Features::HorizontalAxis) && !_enabledFeatures.testFlag(Features::HorizontalAxis))
{
_horizontalAxis = new QGraphicsLineItem(this->scene()->sceneRect().left(), 0,
this->scene()->sceneRect().right(), 0);
this->scene()->addItem(_horizontalAxis);

_enabledFeatures = _enabledFeatures | Features::HorizontalAxis;
_enabledFeatures |= Features::HorizontalAxis;
}

if (Features::VerticalAxis == (Features::VerticalAxis & features) &&
Features::VerticalAxis != (Features::VerticalAxis & _enabledFeatures))
if (features.testFlag(Features::VerticalAxis) && !_enabledFeatures.testFlag(Features::VerticalAxis))
{
_verticalAxis = new QGraphicsLineItem(0, this->scene()->sceneRect().bottom(),
0, this->scene()->sceneRect().top());
this->scene()->addItem(_verticalAxis);

_enabledFeatures = _enabledFeatures | Features::HorizontalAxis;
_enabledFeatures |= Features::VerticalAxis;
}

if (features.testFlag(Features::DropImageHereText) && !_enabledFeatures.testFlag(Features::DropImageHereText))
{
QFont font;
font.setWeight(QFont::Light);
this->scene()->addText(tr("Drop Image Here"), font);

_enabledFeatures |= Features::DropImageHereText;
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/patheditor/patheditorwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ namespace patheditor
{
None = 0x0,
HorizontalAxis = 0x1,
VerticalAxis = 0x2
VerticalAxis = 0x2,
DropImageHereText = 0x4
};
};

Expand Down
4 changes: 2 additions & 2 deletions src/version_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef VERSION_AUTOGEN_H
#define VERSION_AUTOGEN_H

#define BUILD_NUMBER 352
#define COMMIT_HASH "77a55005650e2aa78cd80c0b4c3e1b76d2220f37"
#define BUILD_NUMBER 353
#define COMMIT_HASH "a45befc3866d18dbca7290023983495fdd65f5a9"

#endif // VERSION_AUTOGEN_H

0 comments on commit 51798eb

Please sign in to comment.