Skip to content

Commit

Permalink
Object creator can make itemgroups (CleverRaven#58750)
Browse files Browse the repository at this point in the history
* Basic functionality

* Refactor, styling

* refactoring, item name i tooltip

* Lose a column in the entries box

By setting a background color we can do without the GI column

* Add listwidget_drag

* Add entrieslist and distributioncollection classes

They are used in new commits down the line

* Adjust main menu to accomodate the new item group button.

* You can now drag and drop items into the lsit

But in this commit the json isn't properlty updated so it needs to be added back in later.

* Can now write basic nested json

* Re-did the layout for the entries box

* More layout

* Did most of the layout

* Solved a drag and drop issue, all properties update json now

* Formatting

* Prevent useless json, add tooltips
  • Loading branch information
snipercup authored Jul 29, 2022
1 parent a8e1cd7 commit 44e1cd7
Show file tree
Hide file tree
Showing 6 changed files with 907 additions and 6 deletions.
29 changes: 23 additions & 6 deletions object_creator/creator_main_window.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "creator_main_window.h"

#include "spell_window.h"
#include "item_group_window.h"
#include "enum_conversions.h"
#include "translations.h"
#include "worldfactory.h"
Expand All @@ -19,6 +20,7 @@ namespace io
{
switch( data ) {
case creator::jsobj_type::SPELL: return "Spell";
case creator::jsobj_type::item_group: return "Item group";
case creator::jsobj_type::LAST: break;
}
debugmsg( "Invalid valid_target" );
Expand All @@ -33,23 +35,24 @@ int creator::main_window::execute( QApplication &app )
const int default_text_box_height = 20;
const int default_text_box_width = 100;
const QSize default_text_box_size( default_text_box_width, default_text_box_height );

int row = 0;
int col = 0;
int max_row = 0;
int max_col = 0;

QMainWindow title_menu;
spell_window spell_editor( &title_menu );

//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
QSettings settings( QSettings::IniFormat, QSettings::UserScope,
"CleverRaven", "Cataclysm - DDA" );


// =========================================================================================
// first column of boxes
row = 0;

QMainWindow title_menu;
spell_window spell_editor( &title_menu );
item_group_window item_group_editor( &title_menu );

QLabel mods_label;
mods_label.setParent( &title_menu );
Expand Down Expand Up @@ -95,16 +98,30 @@ int creator::main_window::execute( QApplication &app )
} );


// =========================================================================================
// second column of boxes
col++;

QPushButton item_group_button( _( "Item group Creator" ), &title_menu );
item_group_button.move( QPoint( col * default_text_box_width, row++ * default_text_box_height ) );
item_group_button.resize( 150, 30 );

QObject::connect( &item_group_button, &QPushButton::released,
[&]() {
title_menu.hide();
item_group_editor.show();
} );

title_menu.show();
spell_button.show();
item_group_button.show();

row += 3;
col += 6;
max_row = std::max( max_row, row );
max_col = std::max( max_col, col );
title_menu.resize( QSize( ( max_col + 1 ) * default_text_box_width,
( max_row )*default_text_box_height ) );
( max_row )*default_text_box_height ) );


return app.exec();
Expand Down
1 change: 1 addition & 0 deletions object_creator/creator_main_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class main_window

enum class jsobj_type {
SPELL,
item_group,
LAST
};
}
Expand Down
Loading

0 comments on commit 44e1cd7

Please sign in to comment.