renaming main window

also fixing project creation UI, it's pretty cool now
This commit is contained in:
Alister
2021-12-25 23:24:57 +00:00
parent b754e630d1
commit 0818c0840d
10 changed files with 188 additions and 103 deletions

View File

@@ -22,7 +22,7 @@
#include <noggit/ui/Toolbar.h> // Noggit::Ui::toolbar
#include <noggit/ui/Water.h>
#include <noggit/ui/ZoneIDBrowser.h>
#include <noggit/ui/windows/mainWindow/main_window.hpp>
#include <noggit/ui/windows/noggitWindow/NoggitWindow.hpp>
#include <noggit/ui/minimap_widget.hpp>
#include <noggit/ui/ShaderTool.hpp>
#include <noggit/ui/TerrainTool.hpp>
@@ -2502,7 +2502,7 @@ void MapView::createGUI()
setupHelpMenu();
setupHotkeys();
connect(_main_window, &Noggit::Ui::main_window::exit_prompt_opened, this, &MapView::on_exit_prompt);
connect(_main_window, &Noggit::Ui::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::main_window* main_window
, Noggit::Ui::NoggitWindow* NoggitWindow
, std::unique_ptr<World> world
, uid_fix_mode uid_fix
, bool from_bookmark
@@ -2537,7 +2537,7 @@ MapView::MapView( math::degrees camera_yaw0
, _settings (new QSettings (this))
, cursor_color (1.f, 1.f, 1.f, 1.f)
, _cursorType{CursorType::CIRCLE}
, _main_window (main_window)
, _main_window (NoggitWindow)
, _world (std::move (world))
, _status_position (new QLabel (this))
, _status_selection (new QLabel (this))

View File

@@ -80,7 +80,7 @@ namespace Noggit
class zone_id_browser;
class texture_palette_small;
class hole_tool;
struct main_window;
struct NoggitWindow;
struct tileset_chooser;
class ObjectPalette;
}
@@ -228,7 +228,7 @@ public:
MapView ( math::degrees ah0
, math::degrees av0
, glm::vec3 camera_pos
, Noggit::Ui::main_window*
, Noggit::Ui::NoggitWindow*
, std::unique_ptr<World>
, uid_fix_mode uid_fix = uid_fix_mode::none
, bool from_bookmark = false
@@ -309,7 +309,7 @@ private:
virtual void focusOutEvent (QFocusEvent*) override;
virtual void enterEvent(QEvent*) override;
Noggit::Ui::main_window* _main_window;
Noggit::Ui::NoggitWindow* _main_window;
glm::vec4 normalized_device_coords (int x, int y) const;
float aspect_ratio() const;

View File

@@ -6,7 +6,7 @@
#include <memory>
#include <filesystem>
#include <ClientData.hpp>
#include <noggit/ui/windows/mainWindow/main_window.hpp>
#include <noggit/ui/windows/NoggitWindow/NoggitWindow.hpp>
#include <noggit/application/Configuration/NoggitApplicationConfiguration.hpp>
#include <noggit/application/Configuration/NoggitApplicationConfigurationReader.hpp>
#include <noggit/application/Configuration/NoggitApplicationConfigurationWriter.hpp>

View File

@@ -3,7 +3,7 @@
#include "MapCreationWizard.hpp"
#include <noggit/ui/FontAwesome.hpp>
#include <noggit/ui/windows/mainWindow/main_window.hpp>
#include <noggit/ui/windows/NoggitWindow/NoggitWindow.hpp>
#include <noggit/MapView.h>
#include <noggit/World.h>
#include <noggit/Log.h>
@@ -235,8 +235,8 @@ MapCreationWizard::MapCreationWizard(std::shared_ptr<Project::NoggitProject> pro
removeMap();
});
_connection = connect(reinterpret_cast<Noggit::Ui::main_window*>(parent),
QOverload<int>::of(&Noggit::Ui::main_window::map_selected)
_connection = connect(reinterpret_cast<Noggit::Ui::NoggitWindow*>(parent),
QOverload<int>::of(&Noggit::Ui::NoggitWindow::map_selected)
, [&] (int index)
{
selectMap(index);

View File

@@ -4,7 +4,7 @@
#include <noggit/Log.h>
#include <noggit/World.h>
#include <noggit/ContextObject.hpp>
#include <noggit/ui/windows/mainWindow/main_window.hpp>
#include <noggit/ui/windows/NoggitWindow/NoggitWindow.hpp>
#include <noggit/MapView.h>
#include <noggit/ui/windows/settingsPanel/SettingsPanel.h>
#include <noggit/ui/minimap_widget.hpp>
@@ -53,7 +53,7 @@ public:
namespace Noggit::Ui
{
main_window::main_window(std::shared_ptr<Noggit::Application::NoggitApplicationConfiguration> application,
NoggitWindow::NoggitWindow(std::shared_ptr<Noggit::Application::NoggitApplicationConfiguration> application,
std::shared_ptr<Noggit::Project::NoggitProject> project)
: QMainWindow (nullptr)
, _null_widget (new QWidget (this))
@@ -122,7 +122,7 @@ namespace Noggit::Ui
build_menu();
}
void main_window::check_uid_then_enter_map
void NoggitWindow::check_uid_then_enter_map
( glm::vec3 pos
, math::degrees camera_pitch
, math::degrees camera_yaw
@@ -174,7 +174,7 @@ namespace Noggit::Ui
}
}
void main_window::enterMapAt ( glm::vec3 pos
void NoggitWindow::enterMapAt ( glm::vec3 pos
, math::degrees camera_pitch
, math::degrees camera_yaw
, uid_fix_mode uid_fix
@@ -193,7 +193,7 @@ namespace Noggit::Ui
}
void main_window::loadMap(int mapID)
void NoggitWindow::loadMap(int mapID)
{
_minimap->world (nullptr);
@@ -211,7 +211,7 @@ namespace Noggit::Ui
}
void main_window::build_menu()
void NoggitWindow::build_menu()
{
_stack_widget = new StackedWidget(this);
_stack_widget->setAutoResize(true);
@@ -332,7 +332,7 @@ namespace Noggit::Ui
_minimap->adjustSize();
}
void Noggit::Ui::main_window::build_map_lists()
void Noggit::Ui::NoggitWindow::build_map_lists()
{
std::array<QListWidget*, 6> type_to_table
{{_continents_table, _dungeons_table, _raids_table, _battlegrounds_table, _arenas_table, _scenarios_table}};
@@ -383,7 +383,7 @@ namespace Noggit::Ui
}
void main_window::createBookmarkList()
void NoggitWindow::createBookmarkList()
{
mBookmarks.clear();
@@ -414,7 +414,7 @@ namespace Noggit::Ui
f.close();
}
void main_window::closeEvent (QCloseEvent* event)
void NoggitWindow::closeEvent (QCloseEvent* event)
{
if (map_loaded)
{
@@ -427,7 +427,7 @@ namespace Noggit::Ui
}
}
void main_window::prompt_exit(QCloseEvent* event)
void NoggitWindow::prompt_exit(QCloseEvent* event)
{
emit exit_prompt_opened();
@@ -464,7 +464,7 @@ namespace Noggit::Ui
}
}
void main_window::prompt_uid_fix_failure()
void NoggitWindow::prompt_uid_fix_failure()
{
_stack_widget->setCurrentIndex(0);

View File

@@ -25,12 +25,12 @@ namespace Noggit
class settings;
class about;
struct main_window : QMainWindow
struct NoggitWindow : QMainWindow
{
Q_OBJECT
public:
main_window(std::shared_ptr<Noggit::Application::NoggitApplicationConfiguration> application,
NoggitWindow(std::shared_ptr<Noggit::Application::NoggitApplicationConfiguration> application,
std::shared_ptr<Noggit::Project::NoggitProject> project);
void prompt_exit(QCloseEvent* event);

View File

@@ -12,29 +12,50 @@ NoggitProjectCreationDialog::NoggitProjectCreationDialog(ProjectInformation& pro
ui->setupUi(this);
QObject::connect(ui->button_folder_select, &QPushButton::clicked
QIcon icon = QIcon(":/icon-wrath");
ui->expansion_icon->setPixmap(icon.pixmap(QSize(32, 32)));
ui->expansion_icon->setObjectName("icon");
ui->expansion_icon->setStyleSheet("QLabel#icon { padding: 0px }");
ui->projectPathField_browse->setObjectName("icon");
QObject::connect(ui->project_expansion, QOverload<int>::of(&QComboBox::currentIndexChanged)
, [&](int index)
{
auto versionSelected = ui->project_expansion->currentText().toStdString();
QIcon icon;
if (versionSelected == "Wrath Of The Lich King")
icon = QIcon(":/icon-wrath");
if (versionSelected == "Shadowlands")
icon = QIcon(":/icon-shadow");
ui->expansion_icon->setPixmap(icon.pixmap(QSize(32, 32)));
}
);
QObject::connect(ui->projectPathField_browse, &QPushButton::clicked
, [&]
{
QSettings settings;
auto defaultPath = settings.value("project/game_path").toString();
ui->game_client_apth->setText(defaultPath);
ui->projectPathField->setText(defaultPath);
QString folderName = QFileDialog::getExistingDirectory(parent, "Select Client Directory", defaultPath, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
ui->game_client_apth->setText(folderName);
ui->projectPathField->setText(folderName);
}
);
QObject::connect(ui->button_ok, &QPushButton::clicked
, [&]
{
projectInformation.ProjectName = ui->project_name->text().toStdString();
projectInformation.GameClientPath = ui->game_client_apth->text().toStdString();
projectInformation.ProjectName = ui->projectName->text().toStdString();
projectInformation.GameClientPath = ui->projectPathField->text().toStdString();
projectInformation.GameClientVersion = ui->project_expansion->currentText().toStdString();
close();
}
);
QObject::connect(ui->button_cancel, &QPushButton::clicked
, [&]
{

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>390</width>
<height>275</height>
<height>200</height>
</rect>
</property>
<property name="windowTitle">
@@ -18,73 +18,140 @@
<normalon>:/icon</normalon>
</iconset>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>New Project Settings</string>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>371</width>
<height>181</height>
<x>0</x>
<y>0</y>
<width>390</width>
<height>150</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Project Name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="project_name"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Game Client Directory</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="game_client_apth"/>
</item>
<item>
<widget class="QPushButton" name="button_folder_select">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Project Expansion</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="project_expansion">
<layout class="QVBoxLayout" name="verticalLayout_21">
<item>
<property name="text">
<string>Wrath Of The Lich King</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_24">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="labelx">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Project Name</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="projectName">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<property name="text">
<string>Shadowlands</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_25">
<item>
<widget class="QLabel" name="label_26">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Game Client Path</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="projectPathField"/>
</item>
<item>
<widget class="QPushButton" name="projectPathField_browse">
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
</item>
</layout>
</item>
</widget>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_36">
<item>
<widget class="QLabel" name="label_27">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Project Expansion</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="project_expansion">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Wrath Of The Lich King</string>
</property>
</item>
<item>
<property name="text">
<string>Shadowlands</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="expansion_icon">
<property name="minimumSize">
<size>
<width>32</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
@@ -94,9 +161,9 @@
<property name="geometry">
<rect>
<x>310</x>
<y>230</y>
<width>71</width>
<height>31</height>
<y>160</y>
<width>70</width>
<height>30</height>
</rect>
</property>
<property name="text">
@@ -107,9 +174,9 @@
<property name="geometry">
<rect>
<x>240</x>
<y>230</y>
<width>61</width>
<height>31</height>
<y>160</y>
<width>60</width>
<height>30</height>
</rect>
</property>
<property name="text">
@@ -117,6 +184,4 @@
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -3,7 +3,6 @@
#include <noggit/ui/windows/projectSelection/components/CreateProjectComponent.hpp>
#include "ui_NoggitProjectSelectionWindow.h"
#include <filesystem>
#include <qstringlistmodel.h>
#include <QString>
#include "components/LoadProjectComponent.hpp"
@@ -57,7 +56,7 @@ namespace Noggit::Ui::Windows
{
auto selectedProject = _loadProjectComponent->LoadProject(this);
projectSelectionPage = std::make_unique<Noggit::Ui::main_window>(_noggitApplication->GetConfiguration(), selectedProject);
projectSelectionPage = std::make_unique<Noggit::Ui::NoggitWindow>(_noggitApplication->GetConfiguration(), selectedProject);
projectSelectionPage->showMaximized();
close();

View File

@@ -8,7 +8,7 @@
#include <qgraphicseffect.h>
#include <QString>
#include <noggit/application/NoggitApplication.hpp>
#include <noggit/ui/windows/mainWindow/main_window.hpp>
#include <noggit/ui/windows/NoggitWindow/NoggitWindow.hpp>
#include <noggit/ui/windows/projectCreation/NoggitProjectCreationDialog.h>
QT_BEGIN_NAMESPACE
@@ -44,7 +44,7 @@ namespace Noggit::Ui::Windows
::Ui::NoggitProjectSelectionWindow* ui;
Noggit::Ui::settings* _settings;
std::unique_ptr<Noggit::Ui::main_window> projectSelectionPage;
std::unique_ptr<Noggit::Ui::NoggitWindow> projectSelectionPage;
std::unique_ptr<Component::ExistingProjectEnumerationComponent> _existingProjectEnumerationComponent;
std::unique_ptr<Component::CreateProjectComponent> _createProjectComponent;