File: mapslistview.h

package info (click to toggle)
kimagemapeditor 4%3A25.04.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,140 kB
  • sloc: cpp: 6,817; xml: 207; sh: 5; makefile: 3
file content (127 lines) | stat: -rw-r--r-- 3,096 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/***************************************************************************
                          mapslistview.h  -  description
                             -------------------
    begin                : Weg Feb 26 2003
    copyright            : (C) 2003 by Jan Schäfer
    email                : janschaefer@users.sourceforge.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef _MAPSLISTVIEW_H_
#define _MAPSLISTVIEW_H_

#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QWidget>

#include "kimagemapeditor.h"

/**
 * Simple class that shows all map tags of the current open html file in a ListView
 *
 * Jan Schaefer
 **/
class MapsListView : public QWidget
{
Q_OBJECT
public:
  explicit MapsListView(QWidget *parent);
  ~MapsListView() override;

  /**
   * Adds the given map to the ListView
   */
  void addMap(const QString &);

  /**
   * Adds all maps of the given QList to the ListView
   */
  void addMaps(const QList<MapTag*> &);

  /**
   * Removes the given map from the ListView
   */
  void removeMap(const QString &);

  /**
   * Set to the given map selected in the ListView.
   * it does not emit mapSelected afterwards.
   */
  void selectMap(const QString &);

  /**
   * Selects the given ListViewItem and deselects the current selected item
   */
  void selectMap(QTreeWidgetItem* item);

  /**
   * Changes the name of the map with the @p oldName to @p newName
   */
  void changeMapName(const QString & oldName, const QString & newName);

  /**
   * Returns the current selected map
   */
  QString selectedMap();


  /**
   * Removes all maps from the ListView
   */
  void clear();

  /**
   * Returns a name for a map which is not used yet.
   * Returns for example Unnamed1
   */
  QString getUnusedMapName();

  /**
   * Whether or not the given map name already exists
   */
  bool nameAlreadyExists(const QString &);

  /**
   * Returns a QStringList of all maps
   */
  QStringList getMaps();

  /**
   * Returns the number of maps
   */
  int count();

  QTreeWidget* listView() { return _listView; }
protected:
  QTreeWidget* _listView;

protected slots:
  void slotSelectionChanged();
  void slotItemRenamed(QTreeWidgetItem*);

signals:

  /**
   * Gets emitted when the user selects a map in
   * the ListView
   */
  void mapSelected(const QString &);


  /**
   * Emitted when the user has renamed a map in the ListView
   */
  void mapRenamed(const QString & newName);


};

#endif