mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:49:58 +00:00
Add the configuration widget to the bottom box
Conflicts: apps/opencs/view/world/tablebottombox.cpp
This commit is contained in:
parent
b667500ae2
commit
297373f436
2 changed files with 42 additions and 12 deletions
|
@ -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,
|
||||
CSMDoc::Document& document,
|
||||
const CSMWorld::UniversalId& id,
|
||||
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)
|
||||
mStatusCount[i] = 0;
|
||||
|
@ -77,13 +85,15 @@ CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFacto
|
|||
{
|
||||
mLayout->addWidget (mCreator);
|
||||
|
||||
connect (mCreator, SIGNAL (done()), this, SLOT (createRequestDone()));
|
||||
connect (mCreator, SIGNAL (done()), this, SLOT (requestDone()));
|
||||
|
||||
connect (mCreator, 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)
|
||||
|
@ -101,7 +111,7 @@ void CSVWorld::TableBottomBox::setStatusBar (bool show)
|
|||
{
|
||||
if (show!=mShowStatusBar)
|
||||
{
|
||||
setVisible (show || mCreating);
|
||||
setVisible (show || (mEditMode != EditMode_None));
|
||||
|
||||
mShowStatusBar = show;
|
||||
|
||||
|
@ -115,7 +125,7 @@ bool CSVWorld::TableBottomBox::canCreateAndDelete() const
|
|||
return mCreator;
|
||||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::createRequestDone()
|
||||
void CSVWorld::TableBottomBox::requestDone()
|
||||
{
|
||||
if (!mShowStatusBar)
|
||||
setVisible (false);
|
||||
|
@ -123,8 +133,7 @@ void CSVWorld::TableBottomBox::createRequestDone()
|
|||
updateStatus();
|
||||
|
||||
mLayout->setCurrentWidget (mStatusBar);
|
||||
|
||||
mCreating = false;
|
||||
mEditMode = EditMode_None;
|
||||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::selectionSizeChanged (int size)
|
||||
|
@ -182,7 +191,7 @@ void CSVWorld::TableBottomBox::createRequest()
|
|||
mCreator->toggleWidgets(true);
|
||||
mLayout->setCurrentWidget (mCreator);
|
||||
setVisible (true);
|
||||
mCreating = true;
|
||||
mEditMode = EditMode_Creation;
|
||||
mCreator->focus();
|
||||
}
|
||||
|
||||
|
@ -194,6 +203,16 @@ void CSVWorld::TableBottomBox::cloneRequest(const std::string& id,
|
|||
mLayout->setCurrentWidget(mCreator);
|
||||
mCreator->toggleWidgets(false);
|
||||
setVisible (true);
|
||||
mCreating = true;
|
||||
mEditMode = EditMode_Creation;
|
||||
mCreator->focus();
|
||||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::extendedDeleteConfigRequest()
|
||||
{
|
||||
extendedConfigRequest(ExtendedCommandConfigurator::Mode_Delete);
|
||||
}
|
||||
|
||||
void CSVWorld::TableBottomBox::extendedRevertConfigRequest()
|
||||
{
|
||||
extendedConfigRequest(ExtendedCommandConfigurator::Mode_Revert);
|
||||
}
|
||||
|
|
|
@ -4,10 +4,11 @@
|
|||
#include <QWidget>
|
||||
#include <apps/opencs/model/world/universalid.hpp>
|
||||
|
||||
#include "extendedcommandconfigurator.hpp"
|
||||
|
||||
class QLabel;
|
||||
class QStackedLayout;
|
||||
class QStatusBar;
|
||||
class QUndoStack;
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
|
@ -23,12 +24,17 @@ namespace CSVWorld
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
enum EditMode { EditMode_None, EditMode_Creation, EditMode_ExtendedConfig };
|
||||
|
||||
bool mShowStatusBar;
|
||||
QLabel *mStatus;
|
||||
QStatusBar *mStatusBar;
|
||||
int mStatusCount[4];
|
||||
|
||||
EditMode mEditMode;
|
||||
Creator *mCreator;
|
||||
bool mCreating;
|
||||
ExtendedCommandConfigurator *mExtendedConfigurator;
|
||||
|
||||
QStackedLayout *mLayout;
|
||||
bool mHasPosition;
|
||||
int mRow;
|
||||
|
@ -42,6 +48,8 @@ namespace CSVWorld
|
|||
|
||||
void updateStatus();
|
||||
|
||||
void extendedConfigRequest(ExtendedCommandConfigurator::Mode mode);
|
||||
|
||||
public:
|
||||
|
||||
TableBottomBox (const CreatorFactoryBase& creatorFactory,
|
||||
|
@ -68,7 +76,7 @@ namespace CSVWorld
|
|||
|
||||
private slots:
|
||||
|
||||
void createRequestDone();
|
||||
void requestDone();
|
||||
///< \note This slot being called does not imply success.
|
||||
|
||||
public slots:
|
||||
|
@ -87,6 +95,9 @@ namespace CSVWorld
|
|||
void createRequest();
|
||||
void cloneRequest(const std::string& id,
|
||||
const CSMWorld::UniversalId::Type type);
|
||||
|
||||
void extendedDeleteConfigRequest();
|
||||
void extendedRevertConfigRequest();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue