Skip to content

Commit

Permalink
Version 32.0.0
Browse files Browse the repository at this point in the history
- final cleanup and fixes for 32.0
- fixed widget toolbar for groups/search/etc
- moved the details dock tabs to the top
  • Loading branch information
splintermind committed Nov 30, 2015
1 parent 1cb3d98 commit 9553f17
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 46 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
### Version 32.0 Patch Notes

***
- moved the gridview controls (grouping, searching, population counts) to their own toolbar, which can be moved, hidden, etc.
- changed the unit details dock to display skills, attributes, preferences, etc. in individual dock windows instead of using tables/trees in a splitter.
- updated some thought descriptions
- updated/fixed skill_level functions for scripts and updated the documentation
- added is_female() script function
- removed alchemy from the hauling labours in the default view

- fixed script functions for get_gender, get_orientation, trained_level
- fixes an issue with rusted dabbling skills showing as legendary
- fixed typos
- fixes setting nicknames/professions (felliott)

### Version 31.0 Patch Notes

***
Expand Down
2 changes: 1 addition & 1 deletion inc/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ THE SOFTWARE.
#define PRODUCT "Dwarf Therapist"

#ifndef DT_VERSION_MAJOR
#define DT_VERSION_MAJOR 31
#define DT_VERSION_MAJOR 32
#endif

#ifndef DT_VERSION_MINOR
Expand Down
1 change: 0 additions & 1 deletion inc/grid_view/viewcolumn.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class ViewColumn : public QObject {
default:
return "DEFAULT";
}
return "???";
}

static inline COLUMN_SORT_TYPE get_sort_type(const QString &name) {
Expand Down
1 change: 1 addition & 0 deletions inc/healthinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class HealthInfo{
m_symbol = "???";
m_color_name = "#FF0000";
m_severity = 99;
m_type_flags = 0;
m_cat_id = eHealth::HI_UNK;
}

Expand Down
2 changes: 0 additions & 2 deletions inc/models/dwarfmodelproxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class DwarfModelProxy: public QSortFilterProxyModel {
QString get_script(const QString script_name) {return m_scripts.value(script_name).script_body;}
void clear_script(const QString script_name = "");
void clear_script(const FILTER_SCRIPT_TYPE sType, const bool refresh);

void refresh_script();
QList<Dwarf*> get_filtered_dwarves();

public slots:
Expand Down
9 changes: 8 additions & 1 deletion src/dfinstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,14 @@ DFInstance::DFInstance(QObject* parent)
, m_heartbeat_timer(new QTimer(this))
, m_dwarf_race_id(0)
, m_dwarf_civ_id(0)
, m_current_year(0)
, m_cur_year_tick(0)
, m_cur_time(0)
, m_languages(0x0)
, m_fortress(0x0)
, m_fortress_name(tr("Embarking"))
, m_fortress_name_translated("")
, m_squad_vector(0)
{
// let subclasses start the heartbeat timer, since we don't want to be
// checking before we're connected
Expand Down Expand Up @@ -1048,9 +1052,12 @@ bool DFInstance::add_new_layout(const QString & version, QFile & file) {
}

MemoryLayout *temp = new MemoryLayout(newFileName);
if (temp && temp->is_valid()) {
if(temp && temp->is_valid()) {
LOGI << "adding valid layout" << temp->game_version() << temp->checksum();
m_memory_layouts.insert(temp->checksum().toLower(), temp);
}else{
LOGI << "ignoring invalid layout from file:" << newFileName;
delete temp;
}
return true;
}
Expand Down
12 changes: 7 additions & 5 deletions src/dwarf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,13 @@ void Dwarf::read_syndromes(){
int race_id = s.get_transform_race();
if(race_id >= 0){
Race *r_trans = m_df->get_race(race_id);
Caste *c_trans = r_trans->get_caste_by_id(0);
if(r_trans && r_trans->flags().has_flag(NIGHT_CREATURE) && c_trans && c_trans->flags().has_flag(CRAZED)){
is_curse = true;
m_curse_type = eCurse::WEREBEAST;
m_curse_name = r_trans->name();
if(r_trans){
Caste *c_trans = r_trans->get_caste_by_id(0);
if(r_trans && r_trans->flags().has_flag(NIGHT_CREATURE) && c_trans && c_trans->flags().has_flag(CRAZED)){
is_curse = true;
m_curse_type = eCurse::WEREBEAST;
m_curse_name = r_trans->name();
}
}
}else if(s.display_name().contains("werecurse",Qt::CaseInsensitive)){
//older version without the necessary offset, use a generic name if it seems like a werecurse
Expand Down
1 change: 1 addition & 0 deletions src/dwarfdetailswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ DwarfDetailsWidget::DwarfDetailsWidget(QWidget *parent, Qt::WindowFlags flags)
dock_area->setObjectName("unit_details_dock_area");
dock_area->setWindowFlags(Qt::Widget);
dock_area->setCentralWidget(0);
dock_area->setTabPosition(Qt::AllDockWidgetAreas,QTabWidget::North);
ui->verticalLayout->addWidget(dock_area);

foreach(QDockWidget *dw, this->findChildren<QDockWidget*>()){
Expand Down
67 changes: 37 additions & 30 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ MainWindow::MainWindow(QWidget *parent)
, m_force_connect(false)
, m_try_download(true)
, m_deleting_settings(false)
, m_toolbar_configured(false)
, m_act_sep_optimize(0)
, m_btn_optimize(0)
{
Expand Down Expand Up @@ -462,12 +463,15 @@ void MainWindow::read_dwarves() {
}
//save the ids of the currently selected dwarfs
QVector<int> ids;
foreach(Dwarf *d, m_view_manager->get_selected_dwarfs()){
ids << d->id();
}
//clear selected dwarfs in the view
if(m_view_manager)
if(m_view_manager){
foreach(Dwarf *d, m_view_manager->get_selected_dwarfs()){
if(d){
ids << d->id();
}
}
//clear selected dwarfs in the view
m_view_manager->clear_selected();
}

//clear data in each column for each view
foreach(GridView *gv, m_view_manager->views()){
Expand Down Expand Up @@ -522,8 +526,9 @@ void MainWindow::read_dwarves() {
i->setData(data,Qt::UserRole+1);
filters->appendRow(i);
}
if(!dwarf_found)
if(!dwarf_found && dock){
dock->clear(false);
}

filters->sort(0,Qt::AscendingOrder);

Expand Down Expand Up @@ -963,35 +968,37 @@ void MainWindow::save_gridview_csv()
QFile f( fileName );
if (f.exists())
f.remove();
f.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out(&f);

QStringList row;
row.append(tr("Name"));
foreach(ViewColumnSet *set, gv->sets()) {
foreach(ViewColumn *col, set->columns()) {
if (col->type() != CT_SPACER)
row.append(col->title());

if(f.open(QIODevice::WriteOnly | QIODevice::Text)){
QTextStream out(&f);

QStringList row;
row.append(tr("Name"));
foreach(ViewColumnSet *set, gv->sets()) {
foreach(ViewColumn *col, set->columns()) {
if (col->type() != CT_SPACER)
row.append(col->title());
}
}
}
out << row.join(",") << endl;
row.clear();

QList<Dwarf*> dwarves = m_proxy->get_filtered_dwarves();
foreach(Dwarf *d, dwarves){
if(d->is_animal() || d->is_adult() || (!DT->hide_non_adults() && !d->is_adult())){
row.append(d->nice_name());
foreach(ViewColumnSet *set, gv->sets()) {
foreach(ViewColumn *col, set->columns()) {
if (col->type() != CT_SPACER)
row.append(col->get_cell_value(d));
out << row.join(",") << endl;
row.clear();

QList<Dwarf*> dwarves = m_proxy->get_filtered_dwarves();
foreach(Dwarf *d, dwarves){
if(d->is_animal() || d->is_adult() || (!DT->hide_non_adults() && !d->is_adult())){
row.append(d->nice_name());
foreach(ViewColumnSet *set, gv->sets()) {
foreach(ViewColumn *col, set->columns()) {
if (col->type() != CT_SPACER)
row.append(col->get_cell_value(d));
}
}
out << row.join(",") << endl;
row.clear();
}
out << row.join(",") << endl;
row.clear();
}
f.close();
}
f.close();
}

void MainWindow::export_gridviews() {
Expand Down
7 changes: 5 additions & 2 deletions src/models/dwarfmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,9 @@ void DwarfModel::build_row(const QString &key) {
}

foreach(Dwarf *d, m_grouped_dwarves.value(key)) {
if(!d)
continue;

QStandardItem *i_name = new QStandardItem(d->nice_name());
bool name_italic = false;

Expand All @@ -515,7 +518,7 @@ void DwarfModel::build_row(const QString &key) {
}

//background gradients for nobles
if(d && m_highlight_nobles){
if(m_highlight_nobles){
if(d->noble_position() != ""){
QColor col = m_df->fortress()->get_noble_color(d->historical_id());
i_name->setData(build_gradient_brush(col,col.alpha(),0,QPoint(0,0),QPoint(1,0)),Qt::BackgroundRole);
Expand All @@ -524,7 +527,7 @@ void DwarfModel::build_row(const QString &key) {
}

//set cursed colors
if(d && m_highlight_cursed){
if(m_highlight_cursed){
switch(d->get_curse_type()){
case eCurse::VAMPIRE:
case eCurse::WEREBEAST:
Expand Down
4 changes: 0 additions & 4 deletions src/models/dwarfmodelproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ void DwarfModelProxy::clear_script(const FILTER_SCRIPT_TYPE sType, const bool re
}
}

void DwarfModelProxy::refresh_script(){
invalidateFilter();
}

bool DwarfModelProxy::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const {
bool matches = true;

Expand Down

0 comments on commit 9553f17

Please sign in to comment.