File indexing completed on 2024-04-14 04:00:22

0001 /***************************************************************************
0002                           cmapzonemanager.h
0003                              -------------------
0004     begin                : Sat Aug 15, 2015
0005     copyright            : (C) 2015 by Tomas Mecir
0006     email                : mecirt@gmail.com
0007  ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef CMAPZONEMANAGER_H
0019 #define CMAPZONEMANAGER_H
0020 
0021 #include <QString>
0022 
0023 class QStandardItemModel;
0024 class CMapManager;
0025 
0026 // Information held about each zone
0027 struct cZoneInformation {
0028   QString name, file;
0029 };
0030 
0031 
0032 /** This exists per each connection, holding the list of zones */
0033 class CMapZoneManager {
0034   public:
0035     CMapZoneManager(int sessId, CMapManager *manager);
0036     virtual ~CMapZoneManager();
0037 
0038     QStandardItemModel *zonesModel();
0039     QString getPath(int idx);
0040     void save(bool always = false);
0041     void loadZone(int idx);
0042     void deleteZone(int idx);
0043     void createZone(const QString &name, const QString &file = QString());
0044     void renameZone(int idx, const QString &name);
0045     void loadMapList();
0046     void saveMapList();
0047     int activeZone();
0048   private:
0049     int createZoneEntry(const QString &name, const QString &file);
0050     cZoneInformation *getZoneEntry(int idx);
0051     struct Private;
0052     Private *d;
0053 };
0054 
0055 
0056 #endif  // CMAPZONEMANAGER_H