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 :
- 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).
- Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges).
- Render tab previews should not rerender when changing render options.
@ -45,6 +44,7 @@ Technology Preview 3 :
- Improve sky rendering (colors and light halo).
- Add a progress indicator on previews.
- Multi threaded first pass.
- Mark modified tabs and ask for losing modifications (idem for layers).
- Fix potential holes in land rendering.
- Progressive final render.
- Propose several backgrounds for water rendering (grid, sinus...).

View file

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

View file

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

View file

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

View file

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