mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-27 02:56:17 -05:00
Merge branch 'dev' of https://github.com/huderlem/porymap into local-id
This commit is contained in:
@@ -43,8 +43,6 @@ protected:
|
||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent*) override;
|
||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*) override;
|
||||
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*) override;
|
||||
virtual void keyPressEvent(QKeyEvent*) override;
|
||||
virtual void focusInEvent(QFocusEvent*) override;
|
||||
|
||||
signals:
|
||||
void connectionItemDoubleClicked(MapConnection*);
|
||||
|
||||
@@ -36,19 +36,17 @@ private:
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent*) override;
|
||||
virtual void focusInEvent(QFocusEvent*) override;
|
||||
virtual void keyPressEvent(QKeyEvent*) override;
|
||||
virtual bool eventFilter(QObject*, QEvent *event) override;
|
||||
|
||||
signals:
|
||||
void selected();
|
||||
void openMapClicked(MapConnection*);
|
||||
|
||||
private slots:
|
||||
void on_comboBox_Direction_currentTextChanged(QString direction);
|
||||
void on_comboBox_Map_currentTextChanged(QString mapName);
|
||||
void on_spinBox_Offset_valueChanged(int offset);
|
||||
void on_button_Delete_clicked();
|
||||
void on_button_OpenMap_clicked();
|
||||
private:
|
||||
void commitDirection();
|
||||
void commitMap(const QString &mapName);
|
||||
void commitMove(int offset);
|
||||
void commitRemove();
|
||||
};
|
||||
|
||||
#endif // CONNECTIONSLISTITEM_H
|
||||
|
||||
@@ -32,4 +32,17 @@ signals:
|
||||
void clicked(QMouseEvent *event);
|
||||
};
|
||||
|
||||
class ConnectionsView : public QGraphicsView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConnectionsView(QWidget *parent = nullptr) : QGraphicsView(parent) {}
|
||||
|
||||
signals:
|
||||
void pressedDelete();
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // GRAPHICSVIEW_H
|
||||
|
||||
@@ -64,6 +64,8 @@ private:
|
||||
QPointer<Project> m_project = nullptr;
|
||||
bool m_allowProjectChanges = true;
|
||||
|
||||
void setText(QComboBox *combo, const QString &text) const;
|
||||
void setText(QLineEdit *lineEdit, const QString &text) const;
|
||||
void setLocations(const QStringList &locations);
|
||||
void updateLocationName();
|
||||
|
||||
|
||||
@@ -10,27 +10,28 @@
|
||||
class MovableRect : public QGraphicsRectItem
|
||||
{
|
||||
public:
|
||||
MovableRect(bool *enabled, int width, int height, QRgb color);
|
||||
MovableRect(bool *enabled, const QRectF &rect, const QRgb &color);
|
||||
QRectF boundingRect() const override {
|
||||
qreal penWidth = 4;
|
||||
return QRectF(-penWidth,
|
||||
-penWidth,
|
||||
30 * 8 + penWidth * 2,
|
||||
20 * 8 + penWidth * 2);
|
||||
this->rect().width() + penWidth * 2,
|
||||
this->rect().height() + penWidth * 2);
|
||||
}
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) override {
|
||||
if (!(*enabled)) return;
|
||||
painter->setPen(this->color);
|
||||
painter->drawRect(this->rect().x() - 2, this->rect().y() - 2, this->rect().width() + 3, this->rect().height() + 3);
|
||||
painter->setPen(QColor(0, 0, 0));
|
||||
painter->drawRect(this->rect().x() - 3, this->rect().y() - 3, this->rect().width() + 5, this->rect().height() + 5);
|
||||
painter->drawRect(this->rect().x() - 1, this->rect().y() - 1, this->rect().width() + 1, this->rect().height() + 1);
|
||||
painter->drawRect(this->rect() + QMargins(1,1,1,1)); // Fill
|
||||
painter->setPen(Qt::black);
|
||||
painter->drawRect(this->rect() + QMargins(2,2,2,2)); // Outer border
|
||||
painter->drawRect(this->rect()); // Inner border
|
||||
}
|
||||
void updateLocation(int x, int y);
|
||||
bool *enabled;
|
||||
|
||||
protected:
|
||||
QRectF baseRect;
|
||||
QRgb color;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,13 +20,16 @@ public:
|
||||
virtual void accept() override;
|
||||
|
||||
signals:
|
||||
void accepted(MapConnection *result);
|
||||
void newConnectionedAdded(const QString &mapName, const QString &direction);
|
||||
void connectionReplaced(const QString &mapName, const QString &direction);
|
||||
|
||||
private:
|
||||
Ui::NewMapConnectionDialog *ui;
|
||||
Map *m_map;
|
||||
|
||||
bool mapNameIsValid();
|
||||
void setWarningVisible(bool visible);
|
||||
bool askReplaceConnection(MapConnection *connection, const QString &newMapName);
|
||||
};
|
||||
|
||||
#endif // NEWMAPCONNECTIONDIALOG_H
|
||||
|
||||
@@ -18,6 +18,9 @@ public:
|
||||
void setLineEdit(QLineEdit *edit);
|
||||
void setFocusedScrollingEnabled(bool enabled);
|
||||
|
||||
signals:
|
||||
void editingFinished();
|
||||
|
||||
private:
|
||||
void setItem(int index, const QString &text);
|
||||
|
||||
|
||||
25
include/ui/noscrolltextedit.h
Normal file
25
include/ui/noscrolltextedit.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef NOSCROLLTEXTEDIT_H
|
||||
#define NOSCROLLTEXTEDIT_H
|
||||
|
||||
#include <QTextEdit>
|
||||
#include <QWheelEvent>
|
||||
|
||||
class NoScrollTextEdit : public QTextEdit
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit NoScrollTextEdit(const QString &text, QWidget *parent = nullptr) : QTextEdit(text, parent) {
|
||||
setFocusPolicy(Qt::StrongFocus);
|
||||
};
|
||||
explicit NoScrollTextEdit(QWidget *parent = nullptr) : NoScrollTextEdit(QString(), parent) {};
|
||||
|
||||
virtual void wheelEvent(QWheelEvent *event) override {
|
||||
if (hasFocus()) {
|
||||
QTextEdit::wheelEvent(event);
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
#endif // NOSCROLLTEXTEDIT_H
|
||||
@@ -149,10 +149,10 @@ public:
|
||||
void select(unsigned tileId);
|
||||
unsigned selectedTile = 0;
|
||||
|
||||
void selectVFlip(bool hFlip) { this->tile_hFlip = hFlip; }
|
||||
void selectHFlip(bool hFlip) { this->tile_hFlip = hFlip; }
|
||||
bool tile_hFlip = false;
|
||||
|
||||
void selectHFlip(bool vFlip) { this->tile_vFlip = vFlip; }
|
||||
void selectVFlip(bool vFlip) { this->tile_vFlip = vFlip; }
|
||||
bool tile_vFlip = false;
|
||||
|
||||
void selectPalette(int palette) {
|
||||
|
||||
@@ -71,8 +71,6 @@ private slots:
|
||||
|
||||
void on_spinBox_paletteSelector_valueChanged(int arg1);
|
||||
|
||||
void on_actionSave_Tileset_triggered();
|
||||
|
||||
void on_actionImport_Primary_Tiles_triggered();
|
||||
|
||||
void on_actionImport_Secondary_Tiles_triggered();
|
||||
@@ -173,6 +171,8 @@ private:
|
||||
bool lockSelection = false;
|
||||
QSet<uint16_t> metatileReloadQueue;
|
||||
|
||||
bool save();
|
||||
|
||||
signals:
|
||||
void tilesetsSaved(QString, QString);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user