Changes to noggit window
moving into correct namespace started moving private methods out into components
This commit is contained in:
@@ -2502,7 +2502,7 @@ void MapView::createGUI()
|
||||
setupHelpMenu();
|
||||
setupHotkeys();
|
||||
|
||||
connect(_main_window, &Noggit::Ui::NoggitWindow::exit_prompt_opened, this, &MapView::on_exit_prompt);
|
||||
connect(_main_window, &Noggit::Ui::Windows::NoggitWindow::exit_prompt_opened, this, &MapView::on_exit_prompt);
|
||||
|
||||
set_editing_mode (editing_mode::ground);
|
||||
}
|
||||
@@ -2525,7 +2525,7 @@ void MapView::on_exit_prompt()
|
||||
MapView::MapView( math::degrees camera_yaw0
|
||||
, math::degrees camera_pitch0
|
||||
, glm::vec3 camera_pos
|
||||
, Noggit::Ui::NoggitWindow* NoggitWindow
|
||||
, Noggit::Ui::Windows::NoggitWindow* NoggitWindow
|
||||
, std::unique_ptr<World> world
|
||||
, uid_fix_mode uid_fix
|
||||
, bool from_bookmark
|
||||
|
||||
@@ -45,6 +45,11 @@
|
||||
|
||||
class World;
|
||||
|
||||
namespace Noggit::Ui::Windows
|
||||
{
|
||||
class NoggitWindow;
|
||||
}
|
||||
|
||||
namespace Noggit
|
||||
{
|
||||
|
||||
@@ -65,6 +70,8 @@ namespace Noggit
|
||||
}
|
||||
|
||||
class Camera;
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class detail_infos;
|
||||
@@ -80,7 +87,6 @@ namespace Noggit
|
||||
class zone_id_browser;
|
||||
class texture_palette_small;
|
||||
class hole_tool;
|
||||
struct NoggitWindow;
|
||||
struct tileset_chooser;
|
||||
class ObjectPalette;
|
||||
}
|
||||
@@ -228,7 +234,7 @@ public:
|
||||
MapView ( math::degrees ah0
|
||||
, math::degrees av0
|
||||
, glm::vec3 camera_pos
|
||||
, Noggit::Ui::NoggitWindow*
|
||||
, Noggit::Ui::Windows::NoggitWindow*
|
||||
, std::unique_ptr<World>
|
||||
, uid_fix_mode uid_fix = uid_fix_mode::none
|
||||
, bool from_bookmark = false
|
||||
@@ -309,7 +315,7 @@ private:
|
||||
virtual void focusOutEvent (QFocusEvent*) override;
|
||||
virtual void enterEvent(QEvent*) override;
|
||||
|
||||
Noggit::Ui::NoggitWindow* _main_window;
|
||||
Noggit::Ui::Windows::NoggitWindow* _main_window;
|
||||
|
||||
glm::vec4 normalized_device_coords (int x, int y) const;
|
||||
float aspect_ratio() const;
|
||||
|
||||
@@ -236,8 +236,8 @@ MapCreationWizard::MapCreationWizard(std::shared_ptr<Project::NoggitProject> pro
|
||||
removeMap();
|
||||
});
|
||||
|
||||
_connection = connect(reinterpret_cast<Noggit::Ui::NoggitWindow*>(parent),
|
||||
QOverload<int>::of(&Noggit::Ui::NoggitWindow::map_selected)
|
||||
_connection = connect(reinterpret_cast<Noggit::Ui::Windows::NoggitWindow*>(parent),
|
||||
QOverload<int>::of(&Noggit::Ui::Windows::NoggitWindow::map_selected)
|
||||
, [&] (int index)
|
||||
{
|
||||
selectMap(index);
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <QStandardPaths>
|
||||
#include <QDir>
|
||||
#include <QIcon>
|
||||
#include <noggit/ui/windows/noggitWindow/components/BuildMapListComponent.hpp>
|
||||
|
||||
#ifdef USE_MYSQL_UID_STORAGE
|
||||
#include <mysql/mysql.h>
|
||||
@@ -44,14 +45,7 @@
|
||||
#include "ui_TitleBar.h"
|
||||
#include <external/framelesshelper/framelesswindowsmanager.h>
|
||||
|
||||
|
||||
class Plugin
|
||||
{
|
||||
public:
|
||||
virtual void execute() = 0;
|
||||
};
|
||||
|
||||
namespace Noggit::Ui
|
||||
namespace Noggit::Ui::Windows
|
||||
{
|
||||
NoggitWindow::NoggitWindow(std::shared_ptr<Noggit::Application::NoggitApplicationConfiguration> application,
|
||||
std::shared_ptr<Noggit::Project::NoggitProject> project)
|
||||
@@ -119,6 +113,8 @@ namespace Noggit::Ui
|
||||
|
||||
_menuBar->adjustSize();
|
||||
|
||||
_buildMapListComponent = std::make_unique<Component::BuildMapListComponent>();
|
||||
|
||||
build_menu();
|
||||
}
|
||||
|
||||
@@ -239,7 +235,7 @@ namespace Noggit::Ui
|
||||
entry_points_tabs->setFixedWidth(300);
|
||||
layout->addWidget (entry_points_tabs);
|
||||
|
||||
build_map_lists();
|
||||
_buildMapListComponent->BuildMapList(this);
|
||||
|
||||
qulonglong bookmark_index (0);
|
||||
for (auto entry : mBookmarks)
|
||||
@@ -300,7 +296,7 @@ namespace Noggit::Ui
|
||||
_map_wizard_connection = connect(_map_creation_wizard, &Noggit::Ui::Tools::MapCreationWizard::Ui::MapCreationWizard::map_dbc_updated
|
||||
,[=]
|
||||
{
|
||||
build_map_lists();
|
||||
_buildMapListComponent->BuildMapList(this);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -313,37 +309,6 @@ namespace Noggit::Ui
|
||||
_minimap->adjustSize();
|
||||
}
|
||||
|
||||
void Noggit::Ui::NoggitWindow::build_map_lists()
|
||||
{
|
||||
_continents_table->clear();
|
||||
|
||||
const auto& table = std::string("Map");
|
||||
auto mapTable = _project->ClientDatabase->LoadTable(table);
|
||||
|
||||
auto iterator = mapTable.Records();
|
||||
while (iterator.HasRecords())
|
||||
{
|
||||
auto record = iterator.Next();
|
||||
|
||||
auto mapListData = Noggit::Ui::Widget::MapListData();
|
||||
mapListData.MapName = QString::fromUtf8(record.Columns["MapName_lang"].Value.c_str());
|
||||
mapListData.MapId = record.RecordId;
|
||||
mapListData.MapTypeId = std::stoi(record.Columns["InstanceType"].Value);
|
||||
mapListData.ExpansionId = std::stoi(record.Columns["ExpansionID"].Value);
|
||||
|
||||
if (mapListData.MapTypeId < 0 || mapListData.MapTypeId > 5 || !World::IsEditableWorld(record))
|
||||
continue;
|
||||
|
||||
auto mapListItem = new Noggit::Ui::Widget::MapListItem(mapListData, _continents_table);
|
||||
auto item = new QListWidgetItem(_continents_table);
|
||||
item->setSizeHint(mapListItem->minimumSizeHint());
|
||||
item->setData(Qt::UserRole, QVariant(mapListData.MapId));
|
||||
_continents_table->setItemWidget(item, mapListItem);
|
||||
}
|
||||
_project->ClientDatabase->UnloadTable(table);
|
||||
}
|
||||
|
||||
|
||||
void NoggitWindow::createBookmarkList()
|
||||
{
|
||||
mBookmarks.clear();
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#pragma once
|
||||
#ifndef NOGGIT_WINDOW_NOGGIT_HPP
|
||||
#define NOGGIT_WINDOW_NOGGIT_HPP
|
||||
|
||||
#include <math/trig.hpp>
|
||||
#include <noggit/World.h>
|
||||
#include <noggit/MapView.h>
|
||||
@@ -15,27 +17,32 @@
|
||||
|
||||
class StackedWidget;
|
||||
|
||||
|
||||
namespace Noggit
|
||||
namespace Noggit::Ui::Component
|
||||
{
|
||||
class BuildMapListComponent;
|
||||
}
|
||||
|
||||
namespace Noggit::Ui
|
||||
{
|
||||
namespace Ui
|
||||
{
|
||||
|
||||
class minimap_widget;
|
||||
class settings;
|
||||
class about;
|
||||
|
||||
struct NoggitWindow : QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
}
|
||||
|
||||
namespace Noggit::Ui::Windows
|
||||
{
|
||||
class NoggitWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
friend Component::BuildMapListComponent;
|
||||
public:
|
||||
NoggitWindow(std::shared_ptr<Noggit::Application::NoggitApplicationConfiguration> application,
|
||||
std::shared_ptr<Noggit::Project::NoggitProject> project);
|
||||
|
||||
void prompt_exit(QCloseEvent* event);
|
||||
void prompt_uid_fix_failure();
|
||||
void build_map_lists();
|
||||
|
||||
QMenuBar* _menuBar;
|
||||
|
||||
@@ -46,8 +53,9 @@ namespace Noggit
|
||||
void map_selected(int map_id);
|
||||
|
||||
private:
|
||||
std::shared_ptr<Noggit::Application::NoggitApplicationConfiguration> _applicationConfiguration;
|
||||
std::shared_ptr<Noggit::Project::NoggitProject> _project;
|
||||
std::unique_ptr<Component::BuildMapListComponent> _buildMapListComponent;
|
||||
std::shared_ptr<Application::NoggitApplicationConfiguration> _applicationConfiguration;
|
||||
std::shared_ptr<Project::NoggitProject> _project;
|
||||
|
||||
void loadMap (int mapID);
|
||||
|
||||
@@ -66,14 +74,6 @@ namespace Noggit
|
||||
|
||||
void createBookmarkList();
|
||||
|
||||
struct MapEntry
|
||||
{
|
||||
int mapID;
|
||||
std::string name;
|
||||
int areaType;
|
||||
int expansion;
|
||||
};
|
||||
|
||||
struct BookmarkEntry
|
||||
{
|
||||
int mapID;
|
||||
@@ -83,7 +83,6 @@ namespace Noggit
|
||||
float camera_pitch;
|
||||
};
|
||||
|
||||
std::vector<MapEntry> mMaps;
|
||||
std::vector<BookmarkEntry> mBookmarks;
|
||||
|
||||
minimap_widget* _minimap;
|
||||
@@ -97,11 +96,6 @@ namespace Noggit
|
||||
QMetaObject::Connection _map_wizard_connection;
|
||||
|
||||
QListWidget* _continents_table;
|
||||
QListWidget* _dungeons_table;
|
||||
QListWidget* _raids_table;
|
||||
QListWidget* _battlegrounds_table;
|
||||
QListWidget* _arenas_table;
|
||||
QListWidget* _scenarios_table;
|
||||
|
||||
std::unique_ptr<World> _world;
|
||||
|
||||
@@ -109,5 +103,5 @@ namespace Noggit
|
||||
|
||||
virtual void closeEvent (QCloseEvent*) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // NOGGIT_WINDOW_NOGGIT_HPP
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef NOGGIT_COMPONENT_BUILD_MAP_LIST_HPP
|
||||
#define NOGGIT_COMPONENT_BUILD_MAP_LIST_HPP
|
||||
|
||||
#include <noggit/ui/windows/noggitWindow/NoggitWindow.hpp>
|
||||
|
||||
namespace Noggit::Ui::Component
|
||||
{
|
||||
class BuildMapListComponent
|
||||
{
|
||||
friend Noggit::Ui::Windows::NoggitWindow;
|
||||
public:
|
||||
void BuildMapList(Noggit::Ui::Windows::NoggitWindow* parent)
|
||||
{
|
||||
parent->_continents_table->clear();
|
||||
|
||||
const auto& table = std::string("Map");
|
||||
auto mapTable = parent->_project->ClientDatabase->LoadTable(table);
|
||||
|
||||
auto iterator = mapTable.Records();
|
||||
while (iterator.HasRecords())
|
||||
{
|
||||
auto record = iterator.Next();
|
||||
|
||||
auto mapListData = Widget::MapListData();
|
||||
mapListData.MapName = QString::fromUtf8(record.Columns["MapName_lang"].Value.c_str());
|
||||
mapListData.MapId = record.RecordId;
|
||||
mapListData.MapTypeId = std::stoi(record.Columns["InstanceType"].Value);
|
||||
mapListData.ExpansionId = std::stoi(record.Columns["ExpansionID"].Value);
|
||||
|
||||
if (mapListData.MapTypeId < 0 || mapListData.MapTypeId > 5 || !World::IsEditableWorld(record))
|
||||
continue;
|
||||
|
||||
auto mapListItem = new Widget::MapListItem(mapListData, parent->_continents_table);
|
||||
auto item = new QListWidgetItem(parent->_continents_table);
|
||||
item->setSizeHint(mapListItem->minimumSizeHint());
|
||||
item->setData(Qt::UserRole, QVariant(mapListData.MapId));
|
||||
parent->_continents_table->setItemWidget(item, mapListItem);
|
||||
}
|
||||
parent->_project->ClientDatabase->UnloadTable(table);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //NOGGIT_COMPONENT_BUILD_MAP_LIST_HPP
|
||||
@@ -1,11 +1,11 @@
|
||||
#include <noggit/ui/windows/projectSelection/NoggitProjectSelectionWindow.h>
|
||||
#include <noggit/ui/windows/projectSelection/components/ExistingProjectEnumerationComponent.hpp>
|
||||
#include <noggit/ui/windows/projectSelection/components/CreateProjectComponent.hpp>
|
||||
#include "ui_NoggitProjectSelectionWindow.h"
|
||||
#include <noggit/ui/windows/projectSelection/components/LoadProjectComponent.hpp>
|
||||
#include <filesystem>
|
||||
#include <QString>
|
||||
|
||||
#include "components/LoadProjectComponent.hpp"
|
||||
#include "ui_NoggitProjectSelectionWindow.h"
|
||||
|
||||
namespace Noggit::Ui::Windows
|
||||
{
|
||||
@@ -56,7 +56,7 @@ namespace Noggit::Ui::Windows
|
||||
{
|
||||
auto selectedProject = _loadProjectComponent->LoadProject(this);
|
||||
|
||||
projectSelectionPage = std::make_unique<Noggit::Ui::NoggitWindow>(_noggitApplication->GetConfiguration(), selectedProject);
|
||||
projectSelectionPage = std::make_unique<Noggit::Ui::Windows::NoggitWindow>(_noggitApplication->GetConfiguration(), selectedProject);
|
||||
projectSelectionPage->showMaximized();
|
||||
|
||||
close();
|
||||
|
||||
@@ -40,11 +40,11 @@ namespace Noggit::Ui::Windows
|
||||
~NoggitProjectSelectionWindow();
|
||||
|
||||
private:
|
||||
Noggit::Application::NoggitApplication* _noggitApplication;
|
||||
::Ui::NoggitProjectSelectionWindow* ui;
|
||||
Noggit::Application::NoggitApplication* _noggitApplication;
|
||||
Noggit::Ui::settings* _settings;
|
||||
|
||||
std::unique_ptr<Noggit::Ui::NoggitWindow> projectSelectionPage;
|
||||
std::unique_ptr<Noggit::Ui::Windows::NoggitWindow> projectSelectionPage;
|
||||
|
||||
std::unique_ptr<Component::ExistingProjectEnumerationComponent> _existingProjectEnumerationComponent;
|
||||
std::unique_ptr<Component::CreateProjectComponent> _createProjectComponent;
|
||||
|
||||
Reference in New Issue
Block a user