fix merge issues
This commit is contained in:
@@ -14,6 +14,8 @@ void BuildMapListComponent::BuildMapList(Noggit::Ui::Windows::NoggitWindow* pare
|
||||
auto mapTable = parent->_project->ClientDatabase->LoadTable(table);
|
||||
|
||||
auto iterator = mapTable.Records();
|
||||
auto pinnedMaps = std::vector<Widget::MapListData>();
|
||||
auto maps = std::vector<Widget::MapListData>();
|
||||
while (iterator.HasRecords())
|
||||
{
|
||||
auto record = iterator.Next();
|
||||
@@ -36,12 +38,29 @@ void BuildMapListComponent::BuildMapList(Noggit::Ui::Windows::NoggitWindow* pare
|
||||
if (mapListData.MapTypeId < 0 || mapListData.MapTypeId > 5 || !World::IsEditableWorld(record))
|
||||
continue;
|
||||
|
||||
auto mapListItem = new Widget::MapListItem(mapListData, parent->_continents_table);
|
||||
if (mapListData.Pinned)
|
||||
{
|
||||
pinnedMaps.push_back(mapListData);
|
||||
}
|
||||
else
|
||||
{
|
||||
maps.push_back(mapListData);
|
||||
}
|
||||
}
|
||||
|
||||
pinnedMaps.insert(pinnedMaps.end(), maps.begin(), maps.end());
|
||||
|
||||
for(auto const & map : pinnedMaps)
|
||||
{
|
||||
auto mapListItem = new Widget::MapListItem(map, parent->_continents_table);
|
||||
auto item = new QListWidgetItem(parent->_continents_table);
|
||||
item->setSizeHint(mapListItem->minimumSizeHint());
|
||||
item->setData(Qt::UserRole, QVariant(mapListData.MapId));
|
||||
item->setData(Qt::UserRole, QVariant(map.MapId));
|
||||
parent->_continents_table->setItemWidget(item, mapListItem);
|
||||
}
|
||||
parent->_project->ClientDatabase->UnloadTable(table);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
parent->_project->ClientDatabase->UnloadTable(table);
|
||||
}
|
||||
@@ -1,61 +1,18 @@
|
||||
#ifndef NOGGIT_COMPONENT_BUILD_MAP_LIST_HPP
|
||||
#define NOGGIT_COMPONENT_BUILD_MAP_LIST_HPP
|
||||
|
||||
namespace Noggit::Ui::Windows
|
||||
{
|
||||
class NoggitWindow;
|
||||
}
|
||||
|
||||
namespace Noggit::Ui::Component
|
||||
{
|
||||
class BuildMapListComponent
|
||||
{
|
||||
friend class 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();
|
||||
auto pinnedMaps = std::vector<Widget::MapListData>();
|
||||
auto maps = std::vector<Widget::MapListData>();
|
||||
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;
|
||||
|
||||
if (mapListData.Pinned)
|
||||
{
|
||||
pinnedMaps.push_back(mapListData);
|
||||
}
|
||||
else
|
||||
{
|
||||
maps.push_back(mapListData);
|
||||
}
|
||||
}
|
||||
|
||||
pinnedMaps.insert(pinnedMaps.end(), maps.begin(), maps.end());
|
||||
|
||||
for(auto const & map : pinnedMaps)
|
||||
{
|
||||
auto mapListItem = new Widget::MapListItem(map, parent->_continents_table);
|
||||
auto item = new QListWidgetItem(parent->_continents_table);
|
||||
item->setSizeHint(mapListItem->minimumSizeHint());
|
||||
item->setData(Qt::UserRole, QVariant(map.MapId));
|
||||
parent->_continents_table->setItemWidget(item, mapListItem);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
parent->_project->ClientDatabase->UnloadTable(table);
|
||||
}
|
||||
void BuildMapList(Noggit::Ui::Windows::NoggitWindow* parent);
|
||||
};
|
||||
}
|
||||
#endif //NOGGIT_COMPONENT_BUILD_MAP_LIST_HPP
|
||||
Reference in New Issue
Block a user