porymap/include/ui/connectionslistitem.h

53 lines
1.3 KiB
C
Raw Normal View History

2024-06-26 21:03:39 +01:00
#ifndef CONNECTIONSLISTITEM_H
#define CONNECTIONSLISTITEM_H
#include "mapconnection.h"
2024-08-15 03:22:54 +01:00
#include "map.h"
2024-06-26 21:03:39 +01:00
#include <QFrame>
#include <QMouseEvent>
#include <QPointer>
2024-06-26 21:03:39 +01:00
namespace Ui {
class ConnectionsListItem;
}
// We show the data for each map connection in the panel on the right side of the Connections tab.
// An instance of this class is used for each item in that list.
2024-08-19 23:49:57 +01:00
// It communicates with the ConnectionPixmapItem on the map through a shared MapConnection pointer.
2024-06-26 21:03:39 +01:00
class ConnectionsListItem : public QFrame
{
Q_OBJECT
public:
2024-07-08 21:01:30 +01:00
explicit ConnectionsListItem(QWidget *parent, MapConnection *connection, const QStringList &mapNames);
2024-06-26 21:03:39 +01:00
~ConnectionsListItem();
void updateUI();
void setSelected(bool selected);
2024-06-26 21:03:39 +01:00
private:
2024-06-26 21:03:39 +01:00
Ui::ConnectionsListItem *ui;
2024-08-19 23:49:57 +01:00
QPointer<MapConnection> connection;
2024-08-15 03:22:54 +01:00
Map *map;
bool isSelected = false;
2024-08-15 03:22:54 +01:00
unsigned actionId = 0;
protected:
2024-08-15 03:22:54 +01:00
void mousePressEvent(QMouseEvent*) override;
signals:
void selected();
2024-08-19 23:49:57 +01:00
void removed(MapConnection*);
void openMapClicked(MapConnection*);
2024-07-01 18:58:58 +01:00
private slots:
2024-08-20 02:31:36 +01:00
void on_comboBox_Direction_currentTextChanged(QString direction);
void on_comboBox_Map_currentTextChanged(QString mapName);
2024-07-01 18:58:58 +01:00
void on_spinBox_Offset_valueChanged(int offset);
void on_button_Delete_clicked();
2024-08-19 23:49:57 +01:00
void on_button_OpenMap_clicked();
2024-06-26 21:03:39 +01:00
};
#endif // CONNECTIONSLISTITEM_H