forked from CleverRaven/Cataclysm-DDA
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Object creator merge windows into a tabbed view (CleverRaven#67955)
* Move mods selector to it's own window Remove the mods selector from the main page into it's own window * Make the spell window and the item group window into a page Instead of showing the itemgroup window and the spell window as separate windows, they become a page inside the main window * Add menubar to main window and clean up code The navigation menu allows you to switch between pages. We don't need the removed code anymore * Add json output to the same window as spell editor - Added the json output to the same window as the spell editor. This allows the spell editor to be included in a tabbed view in the main application - Changed the spell editor to be a QWidged instead of a Qframe since a QFrame is more then we need here. * modselector- Removed layout code and changed to QWidget - Changed the mod selector window to a QWidget since a Qframe is more then we need - Removed some layout code that's no longer needed - This change will cause a segfault when the mod selection is tested so an additional fix is needed. * item_group_window- Change to QWidged and add json output - Changed the item group window from a QFrame to a QWidget - Added the json output to the window (which is now in a tab) * mainwindow- changed to tabbed view - Changed the main window to become a tabbed view that includes all of the other pages. - The menubar is not needed right now so it's removed - The stackedwidget is not fit for this use case and was replaced with the tabbed widget * Mod selector- Move settings and mods_box to h file The application lost track of settings and crashed bause of it. This will fix it. * move mod_selection window to h file in creator_main_window This fixes a crash that would occur when the application is closed. It crashed probably because it lost track of mod_selection_window * Move item_group_json to the third column and set size
- Loading branch information
Showing
8 changed files
with
132 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#ifndef CATA_OBJECT_CREATOR_MOD_SELECTION_WINDOW_H | ||
#define CATA_OBJECT_CREATOR_MOD_SELECTION_WINDOW_H | ||
|
||
//Include Qframe, QLabel and QSpinBox for the mod selection window | ||
#include <QtWidgets/qframe.h> | ||
#include <QtWidgets/qlabel.h> | ||
#include <QtWidgets/qspinbox.h> | ||
#include <QtCore/QSettings> | ||
|
||
#include "dual_list_box.h" | ||
#include "mod_manager.h" | ||
#include "worldfactory.h" | ||
|
||
|
||
namespace creator | ||
{ | ||
class mod_selection_window : public QWidget | ||
{ | ||
|
||
|
||
public: | ||
mod_selection_window( QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() ); | ||
|
||
void show() { | ||
QWidget::show(); | ||
} | ||
|
||
void hide() { | ||
QWidget::hide(); | ||
} | ||
|
||
private: | ||
dual_list_box mods_box; | ||
QSettings* settings; | ||
}; | ||
} | ||
|
||
#endif // CATA_OBJECT_CREATOR_MOD_SELECTION_WINDOW_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#include "mod_selection_window.h" | ||
|
||
|
||
creator::mod_selection_window::mod_selection_window( QWidget *parent, Qt::WindowFlags flags ) | ||
: QWidget ( parent, flags ) | ||
{ | ||
QVBoxLayout* mod_layout = new QVBoxLayout(); | ||
this->setLayout( mod_layout ) ; | ||
|
||
|
||
QLabel* mods_label = new QLabel( "Select mods (restart required):", this ); | ||
mod_layout->addWidget( mods_label ); | ||
|
||
//We always load 'dda' so we exclude it from the mods list | ||
QStringList all_mods; | ||
for( const mod_id &e : world_generator->get_mod_manager().all_mods() ) { | ||
if( !e->obsolete && e->ident.str() != "dda" ) { | ||
all_mods.append( e->ident.c_str() ); | ||
} | ||
} | ||
|
||
//Does nothing on it's own but once settings.setvalue() is called it will create | ||
//an ini file in C:\Users\User\AppData\Roaming\CleverRaven or equivalent directory | ||
settings = new QSettings( QSettings::IniFormat, QSettings::UserScope, | ||
"CleverRaven", "Cataclysm - DDA" ); | ||
|
||
|
||
mods_box.initialize( all_mods ); | ||
mod_layout->addWidget( &mods_box ); | ||
|
||
//When one of the buttons on the mods_box is pressed, | ||
//Get all items from the included list and save them to the ini file | ||
QObject::connect( &mods_box, &dual_list_box::pressed, [&]() { | ||
settings->setValue( "mods/include", mods_box.get_included() ); | ||
} ); | ||
|
||
//A previous selection of mods is loaded from disk and applied to the modlist widget | ||
if( settings->contains( "mods/include" ) ) { | ||
QStringList modlist = settings->value( "mods/include" ).value<QStringList>(); | ||
mods_box.set_included( modlist ); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters