Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestions to User in bottom status-bar regarding current active object Tools (not added for insert-template tool) #1907

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tiled/abstractobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void AbstractObjectTool::mouseMoved(const QPointF &pos,
const QPointF tilePosF = mapDocument()->renderer()->screenToTileCoords(offsetPos);
const int x = qFloor(tilePosF.x());
const int y = qFloor(tilePosF.y());
setStatusInfo(QString(QLatin1String("%1, %2 (%3, %4)")).arg(x).arg(y).arg(pixelPos.x()).arg(pixelPos.y()));
setStatusInfo(QString(QLatin1String("%1, %2 (%3, %4) %5 ")).arg(x).arg(y).arg(pixelPos.x()).arg(pixelPos.y()).arg(mtoolInfo));
}

void AbstractObjectTool::mousePressed(QGraphicsSceneMouseEvent *event)
Expand Down
3 changes: 1 addition & 2 deletions src/tiled/abstractobjecttool.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class AbstractObjectTool : public AbstractTool
* an object group.
*/
void updateEnabledState() override;

QString mtoolInfo;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming style: mToolInfo

MapScene *mapScene() const { return mMapScene; }
ObjectGroup *currentObjectGroup() const;
QList<MapObject*> mapObjectsAt(const QPointF &pos) const;
Expand All @@ -89,7 +89,6 @@ private slots:
private:
void showContextMenu(MapObject *clickedObject,
QPoint screenPos);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't remove the empty line.

MapScene *mMapScene;
};

Expand Down
1 change: 1 addition & 0 deletions src/tiled/createellipseobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CreateEllipseObjectTool::CreateEllipseObjectTool(QObject *parent)
icon.addFile(QLatin1String(":images/48x48/insert-ellipse.png"));
setIcon(icon);
Utils::setThemeIcon(this, "insert-ellipse");
mtoolInfo = tr("Place an ellipse by clicking-and-dragging in any direction. Holding <b>Shift</b> makes it circle and holding <b>Ctrl</b> snaps its size to the tile size.");
languageChanged();
}

Expand Down
1 change: 1 addition & 0 deletions src/tiled/createpointobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ CreatePointObjectTool::CreatePointObjectTool(QObject *parent)
icon.addFile(QLatin1String(":images/48x48/insert-point.png"));
setIcon(icon);
Utils::setThemeIcon(this, "insert-point");
mtoolInfo = tr("<b>Click</b> on the map to position a point object.");
languageChanged();
}

Expand Down
14 changes: 13 additions & 1 deletion src/tiled/createpolygonobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,19 @@ CreatePolygonObjectTool::CreatePolygonObjectTool(QObject *parent)
QIcon icon(QLatin1String(":images/24x24/insert-polygon.png"));
icon.addFile(QLatin1String(":images/48x48/insert-polygon.png"));
setIcon(icon);

<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD

=======
mtoolInfo = tr("<b>First Click</b> determines the location of object and first point of polygon. <b>Right Click</b> or press <b>Enter</b> to finish creating polygon. press <b>Escape</b> to cancel creation of polygon.");
>>>>>>> 7b9ddd1b... added information to be displayed in status bar for object-tools, except not for template object tool
=======
mtoolInfo = tr("<b>First Click</b> determines the location of object and first point of polygon. <b>Right Click</b> or press <b>Enter</b> to finish creating polygon. press <b>Escape</b> to cancel creation of polygon.");
>>>>>>> 7b9ddd1b... added information to be displayed in status bar for object-tools, except not for template object tool
=======
mtoolInfo = tr("<b>First Click</b> determines the location of object and first point of polygon. <b>Right Click</b> or press <b>Enter</b> to finish creating polygon. press <b>Escape</b> to cancel creation of polygon.");
>>>>>>> 7b9ddd1b... added information to be displayed in status bar for object-tools, except not for template object tool
Copy link
Member

@bjorn bjorn Mar 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are conflicts markers, indicating you missed to resolve the conflict before committing (or before continuing the rebase). You can resolve these conflicts by either editing the file in your regular editor, or by using a special merge tool. I personally use Meld with git mergetool for comfortably resolving conflicts.

languageChanged();
}

Expand Down
59 changes: 59 additions & 0 deletions src/tiled/createpolylineobjecttool.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* createpolylineobjecttool.cpp
* Copyright 2014, Martin Ziel <martin.ziel.com>
*
* This file is part of Tiled.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "createpolylineobjecttool.h"

#include "mapobject.h"
#include "mapobjectitem.h"
#include "utils.h"

using namespace Tiled;
using namespace Tiled::Internal;

CreatePolylineObjectTool::CreatePolylineObjectTool(QObject *parent)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't re-create this file. It no longer exists since polyline and polygon creation tools have been merged into one tool now.

: CreateMultipointObjectTool(parent)
{
QIcon icon(QLatin1String(":images/24x24/insert-polyline.png"));
icon.addFile(QLatin1String(":images/48x48/insert-polyline.png"));
setIcon(icon);
mtoolInfo = tr("<b>First Click</b> determines the location of object and first point of polyline. <b>Right Click</b> or press <b>Enter</b> to finish creating polyline. press <b>Escape</b> to cancel creation of polyline.");
languageChanged();
}

void CreatePolylineObjectTool::languageChanged()
{
setName(tr("Insert Polyline"));
setShortcut(QKeySequence(tr("L")));
}

MapObject *CreatePolylineObjectTool::createNewMapObject()
{
MapObject *newMapObject = new MapObject;
newMapObject->setShape(MapObject::Polyline);
return newMapObject;
}

void CreatePolylineObjectTool::finishNewMapObject()
{
if (mNewMapObjectItem->mapObject()->polygon().size() >= 2)
CreateObjectTool::finishNewMapObject();
else
CreateObjectTool::cancelNewMapObject();
}
1 change: 1 addition & 0 deletions src/tiled/createrectangleobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CreateRectangleObjectTool::CreateRectangleObjectTool(QObject *parent)
icon.addFile(QLatin1String(":images/48x48/insert-rectangle.png"));
setIcon(icon);
Utils::setThemeIcon(this, "insert-rectangle");
mtoolInfo = tr("Place a rectangle by clicking-and-dragging in any direction. Holding <b>Shift</b> makes it square and holding <b>Ctrl</b> snaps its size to the tile size.");
languageChanged();
}

Expand Down
1 change: 1 addition & 0 deletions src/tiled/createtextobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ CreateTextObjectTool::CreateTextObjectTool(QObject *parent)
icon.addFile(QLatin1String(":images/48x48/insert-text.png"));
setIcon(icon);
Utils::setThemeIcon(this, "insert-text");
mtoolInfo = tr("<b>Click</b> anywhere on the map to insert text. You can also hold <b>Left mouse button</b> to see default text while placing it on the map, release <b>Left mouse button</b> to place text on the map.");
languageChanged();
}

Expand Down
1 change: 1 addition & 0 deletions src/tiled/createtileobjecttool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ CreateTileObjectTool::CreateTileObjectTool(QObject *parent)
icon.addFile(QLatin1String(":images/48x48/insert-image.png"));
setIcon(icon);
Utils::setThemeIcon(this, "insert-image");
mtoolInfo = tr("First select the tile to place in the Tilesets view. Hold <b>Left mouse button</b> on the map to move the object and release the button to place object. Holding <b>Ctrl</b> snaps the object to tile.");
languageChanged();
}

Expand Down
1 change: 1 addition & 0 deletions src/tiled/editpolygontool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ EditPolygonTool::EditPolygonTool(QObject *parent)
, mClickedObject(nullptr)
, mMode(NoMode)
{
mtoolInfo=tr("<b>Click</b> on a node to select it, hold <b>Shift</b> to select multiple nodes and holding <b>Alt</b> forces moving current selection. Press <b>Delete key</b> to remove currently selected node(s)");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coding style: should have spaces around =

}

EditPolygonTool::~EditPolygonTool()
Expand Down