1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 21:49:55 +00:00

Add the configuration widget to the bottom box

Conflicts:
	apps/opencs/view/world/tablebottombox.cpp
This commit is contained in:
Stanislav Bas 2015-07-02 17:21:47 +03:00 committed by cc9cii
parent b667500ae2
commit 297373f436
2 changed files with 42 additions and 12 deletions

View file

@ -47,11 +47,19 @@ void CSVWorld::TableBottomBox::updateStatus()
} }
} }
void CSVWorld::TableBottomBox::extendedConfigRequest(CSVWorld::ExtendedCommandConfigurator::Mode mode)
{
mExtendedConfigurator->configure (mode);
mLayout->setCurrentWidget (mExtendedConfigurator);
mEditMode = EditMode_ExtendedConfig;
setVisible (true);
}
CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFactory, CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFactory,
CSMDoc::Document& document, CSMDoc::Document& document,
const CSMWorld::UniversalId& id, const CSMWorld::UniversalId& id,
QWidget *parent) QWidget *parent)
: QWidget (parent), mShowStatusBar (false), mCreating (false), mHasPosition (false) : QWidget (parent), mShowStatusBar (false), mEditMode(EditMode_None), mHasPosition (false)
{ {
for (int i=0; i<4; ++i) for (int i=0; i<4; ++i)
mStatusCount[i] = 0; mStatusCount[i] = 0;
@ -77,13 +85,15 @@ CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFacto
{ {
mLayout->addWidget (mCreator); mLayout->addWidget (mCreator);
connect (mCreator, SIGNAL (done()), this, SLOT (createRequestDone())); connect (mCreator, SIGNAL (done()), this, SLOT (requestDone()));
connect (mCreator, SIGNAL (requestFocus (const std::string&)), connect (mCreator, SIGNAL (requestFocus (const std::string&)),
this, SIGNAL (requestFocus (const std::string&))); this, SIGNAL (requestFocus (const std::string&)));
} }
setSizePolicy (QSizePolicy::Ignored, QSizePolicy::Fixed); mExtendedConfigurator = new ExtendedCommandConfigurator (document, id, this);
mLayout->addWidget (mExtendedConfigurator);
connect (mExtendedConfigurator, SIGNAL (done()), this, SLOT (requestDone()));
} }
void CSVWorld::TableBottomBox::setEditLock (bool locked) void CSVWorld::TableBottomBox::setEditLock (bool locked)
@ -101,7 +111,7 @@ void CSVWorld::TableBottomBox::setStatusBar (bool show)
{ {
if (show!=mShowStatusBar) if (show!=mShowStatusBar)
{ {
setVisible (show || mCreating); setVisible (show || (mEditMode != EditMode_None));
mShowStatusBar = show; mShowStatusBar = show;
@ -115,7 +125,7 @@ bool CSVWorld::TableBottomBox::canCreateAndDelete() const
return mCreator; return mCreator;
} }
void CSVWorld::TableBottomBox::createRequestDone() void CSVWorld::TableBottomBox::requestDone()
{ {
if (!mShowStatusBar) if (!mShowStatusBar)
setVisible (false); setVisible (false);
@ -123,8 +133,7 @@ void CSVWorld::TableBottomBox::createRequestDone()
updateStatus(); updateStatus();
mLayout->setCurrentWidget (mStatusBar); mLayout->setCurrentWidget (mStatusBar);
mEditMode = EditMode_None;
mCreating = false;
} }
void CSVWorld::TableBottomBox::selectionSizeChanged (int size) void CSVWorld::TableBottomBox::selectionSizeChanged (int size)
@ -182,7 +191,7 @@ void CSVWorld::TableBottomBox::createRequest()
mCreator->toggleWidgets(true); mCreator->toggleWidgets(true);
mLayout->setCurrentWidget (mCreator); mLayout->setCurrentWidget (mCreator);
setVisible (true); setVisible (true);
mCreating = true; mEditMode = EditMode_Creation;
mCreator->focus(); mCreator->focus();
} }
@ -194,6 +203,16 @@ void CSVWorld::TableBottomBox::cloneRequest(const std::string& id,
mLayout->setCurrentWidget(mCreator); mLayout->setCurrentWidget(mCreator);
mCreator->toggleWidgets(false); mCreator->toggleWidgets(false);
setVisible (true); setVisible (true);
mCreating = true; mEditMode = EditMode_Creation;
mCreator->focus(); mCreator->focus();
} }
void CSVWorld::TableBottomBox::extendedDeleteConfigRequest()
{
extendedConfigRequest(ExtendedCommandConfigurator::Mode_Delete);
}
void CSVWorld::TableBottomBox::extendedRevertConfigRequest()
{
extendedConfigRequest(ExtendedCommandConfigurator::Mode_Revert);
}

View file

@ -4,10 +4,11 @@
#include <QWidget> #include <QWidget>
#include <apps/opencs/model/world/universalid.hpp> #include <apps/opencs/model/world/universalid.hpp>
#include "extendedcommandconfigurator.hpp"
class QLabel; class QLabel;
class QStackedLayout; class QStackedLayout;
class QStatusBar; class QStatusBar;
class QUndoStack;
namespace CSMDoc namespace CSMDoc
{ {
@ -23,12 +24,17 @@ namespace CSVWorld
{ {
Q_OBJECT Q_OBJECT
enum EditMode { EditMode_None, EditMode_Creation, EditMode_ExtendedConfig };
bool mShowStatusBar; bool mShowStatusBar;
QLabel *mStatus; QLabel *mStatus;
QStatusBar *mStatusBar; QStatusBar *mStatusBar;
int mStatusCount[4]; int mStatusCount[4];
EditMode mEditMode;
Creator *mCreator; Creator *mCreator;
bool mCreating; ExtendedCommandConfigurator *mExtendedConfigurator;
QStackedLayout *mLayout; QStackedLayout *mLayout;
bool mHasPosition; bool mHasPosition;
int mRow; int mRow;
@ -42,6 +48,8 @@ namespace CSVWorld
void updateStatus(); void updateStatus();
void extendedConfigRequest(ExtendedCommandConfigurator::Mode mode);
public: public:
TableBottomBox (const CreatorFactoryBase& creatorFactory, TableBottomBox (const CreatorFactoryBase& creatorFactory,
@ -68,7 +76,7 @@ namespace CSVWorld
private slots: private slots:
void createRequestDone(); void requestDone();
///< \note This slot being called does not imply success. ///< \note This slot being called does not imply success.
public slots: public slots:
@ -87,6 +95,9 @@ namespace CSVWorld
void createRequest(); void createRequest();
void cloneRequest(const std::string& id, void cloneRequest(const std::string& id,
const CSMWorld::UniversalId::Type type); const CSMWorld::UniversalId::Type type);
void extendedDeleteConfigRequest();
void extendedRevertConfigRequest();
}; };
} }