forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'miroslavr/master'
This commit is contained in:
commit
da722a5cf1
6 changed files with 29 additions and 19 deletions
|
@ -47,13 +47,13 @@ void ProfilesComboBox::setEditEnabled(bool editable)
|
||||||
|
|
||||||
void ProfilesComboBox::slotTextChanged(const QString &text)
|
void ProfilesComboBox::slotTextChanged(const QString &text)
|
||||||
{
|
{
|
||||||
QPalette *palette = new QPalette();
|
QPalette palette;
|
||||||
palette->setColor(QPalette::Text,Qt::red);
|
palette.setColor(QPalette::Text,Qt::red);
|
||||||
|
|
||||||
int index = findText(text);
|
int index = findText(text);
|
||||||
|
|
||||||
if (text.isEmpty() || (index != -1 && index != currentIndex())) {
|
if (text.isEmpty() || (index != -1 && index != currentIndex())) {
|
||||||
lineEdit()->setPalette(*palette);
|
lineEdit()->setPalette(palette);
|
||||||
} else {
|
} else {
|
||||||
lineEdit()->setPalette(QApplication::palette());
|
lineEdit()->setPalette(QApplication::palette());
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,13 +59,13 @@ void Launcher::TextInputDialog::setOkButtonEnabled(bool enabled)
|
||||||
QPushButton *okButton = mButtonBox->button(QDialogButtonBox::Ok);
|
QPushButton *okButton = mButtonBox->button(QDialogButtonBox::Ok);
|
||||||
okButton->setEnabled(enabled);
|
okButton->setEnabled(enabled);
|
||||||
|
|
||||||
QPalette *palette = new QPalette();
|
QPalette palette;
|
||||||
palette->setColor(QPalette::Text, Qt::red);
|
palette.setColor(QPalette::Text, Qt::red);
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
mLineEdit->setPalette(QApplication::palette());
|
mLineEdit->setPalette(QApplication::palette());
|
||||||
} else {
|
} else {
|
||||||
// Existing profile name, make the text red
|
// Existing profile name, make the text red
|
||||||
mLineEdit->setPalette(*palette);
|
mLineEdit->setPalette(palette);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -594,14 +594,6 @@ namespace MWGui
|
||||||
|
|
||||||
int buttonId = *sender->getUserData<int>();
|
int buttonId = *sender->getUserData<int>();
|
||||||
mSelectedKnownEffectId = mButtonMapping[buttonId];
|
mSelectedKnownEffectId = mButtonMapping[buttonId];
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
|
||||||
{
|
|
||||||
if (it->mEffectID == mSelectedKnownEffectId)
|
|
||||||
{
|
|
||||||
MWBase::Environment::get().getWindowManager()->messageBox ("#{sOnetypeEffectMessage}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const ESM::MagicEffect* effect =
|
const ESM::MagicEffect* effect =
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(mSelectedKnownEffectId);
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(mSelectedKnownEffectId);
|
||||||
|
@ -624,6 +616,15 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->mEffectID == mSelectedKnownEffectId)
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sOnetypeEffectMessage}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mAddEffectDialog.newEffect(effect);
|
mAddEffectDialog.newEffect(effect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,12 @@ ContentSelectorModel::ContentModel::ContentModel(QObject *parent) :
|
||||||
uncheckAll();
|
uncheckAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContentSelectorModel::ContentModel::~ContentModel()
|
||||||
|
{
|
||||||
|
qDeleteAll(mFiles);
|
||||||
|
mFiles.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void ContentSelectorModel::ContentModel::setEncoding(const QString &encoding)
|
void ContentSelectorModel::ContentModel::setEncoding(const QString &encoding)
|
||||||
{
|
{
|
||||||
mEncoding = encoding;
|
mEncoding = encoding;
|
||||||
|
@ -444,7 +450,9 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
|
||||||
foreach (const QString &path, dir.entryList())
|
foreach (const QString &path, dir.entryList())
|
||||||
{
|
{
|
||||||
QFileInfo info(dir.absoluteFilePath(path));
|
QFileInfo info(dir.absoluteFilePath(path));
|
||||||
EsmFile *file = new EsmFile(path);
|
|
||||||
|
if (item(info.absoluteFilePath()) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ESM::ESMReader fileReader;
|
ESM::ESMReader fileReader;
|
||||||
|
@ -453,6 +461,8 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
|
||||||
fileReader.setEncoder(&encoder);
|
fileReader.setEncoder(&encoder);
|
||||||
fileReader.open(dir.absoluteFilePath(path).toStdString());
|
fileReader.open(dir.absoluteFilePath(path).toStdString());
|
||||||
|
|
||||||
|
EsmFile *file = new EsmFile(path);
|
||||||
|
|
||||||
foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles())
|
foreach (const ESM::Header::MasterData &item, fileReader.getGameFiles())
|
||||||
file->addGameFile(QString::fromStdString(item.name));
|
file->addGameFile(QString::fromStdString(item.name));
|
||||||
|
|
||||||
|
@ -462,10 +472,8 @@ void ContentSelectorModel::ContentModel::addFiles(const QString &path)
|
||||||
file->setFilePath (info.absoluteFilePath());
|
file->setFilePath (info.absoluteFilePath());
|
||||||
file->setDescription(decoder->toUnicode(fileReader.getDesc().c_str()));
|
file->setDescription(decoder->toUnicode(fileReader.getDesc().c_str()));
|
||||||
|
|
||||||
|
|
||||||
// Put the file in the table
|
// Put the file in the table
|
||||||
if (item(file->filePath()) == 0)
|
addFile(file);
|
||||||
addFile(file);
|
|
||||||
|
|
||||||
} catch(std::runtime_error &e) {
|
} catch(std::runtime_error &e) {
|
||||||
// An error occurred while reading the .esp
|
// An error occurred while reading the .esp
|
||||||
|
|
|
@ -21,6 +21,7 @@ namespace ContentSelectorModel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ContentModel(QObject *parent = 0);
|
explicit ContentModel(QObject *parent = 0);
|
||||||
|
~ContentModel();
|
||||||
|
|
||||||
void setEncoding(const QString &encoding);
|
void setEncoding(const QString &encoding);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) :
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildContentModel()
|
void ContentSelectorView::ContentSelector::buildContentModel()
|
||||||
{
|
{
|
||||||
mContentModel = new ContentSelectorModel::ContentModel();
|
mContentModel = new ContentSelectorModel::ContentModel(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContentSelectorView::ContentSelector::buildGameFileView()
|
void ContentSelectorView::ContentSelector::buildGameFileView()
|
||||||
|
|
Loading…
Reference in a new issue