paysages : Fixed apply/revert buttons not enabled when deleting single layer.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@338 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-06-07 20:17:04 +00:00 committed by ThunderK
parent d9aa79ea28
commit b85bfb8bf9
5 changed files with 27 additions and 3 deletions

2
TODO
View file

@ -1,6 +1,5 @@
Technology Preview 2 : Technology Preview 2 :
- Fix the fog impression when cloud layer overlaps with ground range. - Fix the fog impression when cloud layer overlaps with ground range.
- Fix forms with layers apply and revert buttons (when deleting last cloud layer, can't apply it).
- Replace zone ranges with curves (with curve input and curve dialog). - Replace zone ranges with curves (with curve input and curve dialog).
- Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges). - Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges).
- Render tab previews should not rerender when changing render options. - Render tab previews should not rerender when changing render options.
@ -45,6 +44,7 @@ Technology Preview 3 :
- Improve sky rendering (colors and light halo). - Improve sky rendering (colors and light halo).
- Add a progress indicator on previews. - Add a progress indicator on previews.
- Multi threaded first pass. - Multi threaded first pass.
- Mark modified tabs and ask for losing modifications (idem for layers).
- Fix potential holes in land rendering. - Fix potential holes in land rendering.
- Progressive final render. - Progressive final render.
- Propose several backgrounds for water rendering (grid, sinus...). - Propose several backgrounds for water rendering (grid, sinus...).

View file

@ -155,16 +155,27 @@ void BaseForm::applyConfig()
void BaseForm::layerAddClicked() void BaseForm::layerAddClicked()
{ {
layerAddedEvent(); layerAddedEvent();
button_apply->setEnabled(true);
button_revert->setEnabled(true);
} }
void BaseForm::layerDelClicked() void BaseForm::layerDelClicked()
{ {
layerDeletedEvent(layer_list->currentIndex()); layerDeletedEvent(layer_list->currentIndex());
button_apply->setEnabled(true);
button_revert->setEnabled(true);
} }
void BaseForm::layerListChanged() void BaseForm::layerListChanged()
{ {
bool changed = button_apply->isEnabled();
layerSelectedEvent(layer_list->currentIndex()); layerSelectedEvent(layer_list->currentIndex());
button_apply->setEnabled(changed);
button_revert->setEnabled(changed);
} }
void BaseForm::addPreview(BasePreview* preview, QString label) void BaseForm::addPreview(BasePreview* preview, QString label)

View file

@ -169,6 +169,7 @@ void PreviewDrawingManager::addChunk(PreviewChunk* chunk)
void PreviewDrawingManager::removeChunks(BasePreview* preview) void PreviewDrawingManager::removeChunks(BasePreview* preview)
{ {
int removed = 0;
for (int i = 0; i < _chunks.size(); i++) for (int i = 0; i < _chunks.size(); i++)
{ {
PreviewChunk* chunk; PreviewChunk* chunk;
@ -180,9 +181,12 @@ void PreviewDrawingManager::removeChunks(BasePreview* preview)
_updateQueue.removeAll(chunk); _updateQueue.removeAll(chunk);
_lock.unlock(); _lock.unlock();
removed++;
i--; i--;
} }
} }
logDebug(QString("[Previews] %1 chunks removed, %2 remaining").arg(removed).arg(_chunks.size()));
} }
void PreviewDrawingManager::updateChunks(BasePreview* preview) void PreviewDrawingManager::updateChunks(BasePreview* preview)
@ -241,6 +245,11 @@ void PreviewDrawingManager::performOneThreadJob()
} }
} }
int PreviewDrawingManager::chunkCount()
{
return _chunks.size();
}
/*************** BasePreview ***************/ /*************** BasePreview ***************/
BasePreview::BasePreview(QWidget* parent) : BasePreview::BasePreview(QWidget* parent) :
QWidget(parent) QWidget(parent)
@ -301,7 +310,7 @@ void BasePreview::stopDrawers()
void BasePreview::reviveAll() void BasePreview::reviveAll()
{ {
logDebug("Reviving all previews"); logDebug("[Previews] Reviving all previews");
_drawing_manager->updateAllChunks(); _drawing_manager->updateAllChunks();
} }
@ -400,6 +409,7 @@ void BasePreview::showEvent(QShowEvent* event)
void BasePreview::resizeEvent(QResizeEvent* event) void BasePreview::resizeEvent(QResizeEvent* event)
{ {
QImage* image; QImage* image;
int added = 0;
this->lock_drawing->lock(); this->lock_drawing->lock();
@ -418,8 +428,10 @@ void BasePreview::resizeEvent(QResizeEvent* event)
for (int y = 0; y < _height; y += 32) for (int y = 0; y < _height; y += 32)
{ {
_drawing_manager->addChunk(new PreviewChunk(this, x, y, x + 32 > _width ? _width - x : 32, y + 32 > _height ? _height - y : 32)); _drawing_manager->addChunk(new PreviewChunk(this, x, y, x + 32 > _width ? _width - x : 32, y + 32 > _height ? _height - y : 32));
added++;
} }
} }
logDebug(QString("[Previews] %1 chunks added, %2 total").arg(added).arg(_drawing_manager->chunkCount()));
delete image; delete image;

View file

@ -117,6 +117,7 @@ public:
void updateChunks(BasePreview* preview); void updateChunks(BasePreview* preview);
void updateAllChunks(); void updateAllChunks();
void performOneThreadJob(); void performOneThreadJob();
int chunkCount();
private: private:
int _thread_count; int _thread_count;

View file

@ -29,7 +29,7 @@
<translation>Annuler les modifications</translation> <translation>Annuler les modifications</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/baseform.cpp" line="279"/> <location filename="../gui_qt/baseform.cpp" line="290"/>
<source>Layer %1</source> <source>Layer %1</source>
<translation>Niveau %1</translation> <translation>Niveau %1</translation>
</message> </message>