mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:23:53 +00:00
Removed debug messages and cleaned up some old code
This commit is contained in:
parent
dcf4d242a5
commit
8b58e53be9
6 changed files with 6 additions and 64 deletions
|
@ -1,5 +1,4 @@
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <components/esm/esm_reader.hpp>
|
#include <components/esm/esm_reader.hpp>
|
||||||
#include <components/files/path.hpp>
|
#include <components/files/path.hpp>
|
||||||
|
@ -74,7 +73,7 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
||||||
|
|
||||||
// Set the row height to the size of the checkboxes
|
// Set the row height to the size of the checkboxes
|
||||||
QCheckBox checkBox;
|
QCheckBox checkBox;
|
||||||
unsigned int height = checkBox.sizeHint().height() + 2;
|
unsigned int height = checkBox.sizeHint().height() + 4;
|
||||||
|
|
||||||
mPluginsTable->verticalHeader()->setDefaultSectionSize(height);
|
mPluginsTable->verticalHeader()->setDefaultSectionSize(height);
|
||||||
|
|
||||||
|
@ -127,8 +126,6 @@ DataFilesPage::DataFilesPage(QWidget *parent) : QWidget(parent)
|
||||||
|
|
||||||
void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
||||||
{
|
{
|
||||||
qDebug() << "setupDataFiles called!";
|
|
||||||
|
|
||||||
// Put the paths in a boost::filesystem vector to use with Files::Collections
|
// Put the paths in a boost::filesystem vector to use with Files::Collections
|
||||||
std::vector<boost::filesystem::path> dataDirs;
|
std::vector<boost::filesystem::path> dataDirs;
|
||||||
|
|
||||||
|
@ -145,15 +142,11 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
||||||
|
|
||||||
for (Files::MultiDirCollection::TIter iter(esm.begin()); iter!=esm.end(); ++iter)
|
for (Files::MultiDirCollection::TIter iter(esm.begin()); iter!=esm.end(); ++iter)
|
||||||
{
|
{
|
||||||
qDebug() << "Master: " << QString::fromStdString(iter->second.filename().string());
|
|
||||||
|
|
||||||
QString currentMaster = QString::fromStdString(iter->second.filename().string());
|
QString currentMaster = QString::fromStdString(iter->second.filename().string());
|
||||||
const QList<QTableWidgetItem*> itemList = mMastersWidget->findItems(currentMaster, Qt::MatchExactly);
|
const QList<QTableWidgetItem*> itemList = mMastersWidget->findItems(currentMaster, Qt::MatchExactly);
|
||||||
|
|
||||||
if (itemList.isEmpty()) // Master is not yet in the widget
|
if (itemList.isEmpty()) // Master is not yet in the widget
|
||||||
{
|
{
|
||||||
qDebug() << "Master not yet in the widget, rowcount is " << i;
|
|
||||||
|
|
||||||
mMastersWidget->insertRow(i);
|
mMastersWidget->insertRow(i);
|
||||||
QTableWidgetItem *item = new QTableWidgetItem(currentMaster);
|
QTableWidgetItem *item = new QTableWidgetItem(currentMaster);
|
||||||
mMastersWidget->setItem(i, 0, item);
|
mMastersWidget->setItem(i, 0, item);
|
||||||
|
@ -213,7 +206,6 @@ void DataFilesPage::setupDataFiles(const QStringList &paths, bool strict)
|
||||||
|
|
||||||
void DataFilesPage::setupConfig()
|
void DataFilesPage::setupConfig()
|
||||||
{
|
{
|
||||||
qDebug() << "setupConfig called";
|
|
||||||
QString config = "./launcher.cfg";
|
QString config = "./launcher.cfg";
|
||||||
QFile file(config);
|
QFile file(config);
|
||||||
|
|
||||||
|
@ -247,11 +239,8 @@ void DataFilesPage::setupConfig()
|
||||||
|
|
||||||
QString currentProfile = mLauncherConfig->value("CurrentProfile").toString();
|
QString currentProfile = mLauncherConfig->value("CurrentProfile").toString();
|
||||||
|
|
||||||
qDebug() << mLauncherConfig->value("CurrentProfile").toString();
|
|
||||||
qDebug() << mLauncherConfig->childGroups();
|
|
||||||
|
|
||||||
if (currentProfile.isEmpty()) {
|
if (currentProfile.isEmpty()) {
|
||||||
qDebug() << "No current profile selected";
|
// No current profile selected
|
||||||
currentProfile = "Default";
|
currentProfile = "Default";
|
||||||
}
|
}
|
||||||
mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(currentProfile));
|
mProfilesComboBox->setCurrentIndex(mProfilesComboBox->findText(currentProfile));
|
||||||
|
@ -407,9 +396,6 @@ void DataFilesPage::deleteProfile()
|
||||||
deleteMessageBox.exec();
|
deleteMessageBox.exec();
|
||||||
|
|
||||||
if (deleteMessageBox.clickedButton() == deleteButton) {
|
if (deleteMessageBox.clickedButton() == deleteButton) {
|
||||||
|
|
||||||
qDebug() << "Delete profile " << profile;
|
|
||||||
|
|
||||||
// Make sure we have no groups open
|
// Make sure we have no groups open
|
||||||
while (!mLauncherConfig->group().isEmpty()) {
|
while (!mLauncherConfig->group().isEmpty()) {
|
||||||
mLauncherConfig->endGroup();
|
mLauncherConfig->endGroup();
|
||||||
|
@ -724,8 +710,6 @@ void DataFilesPage::masterSelectionChanged(const QItemSelection &selected, const
|
||||||
masters.sort();
|
masters.sort();
|
||||||
masterstr = masters.join(","); // Make a comma-separated QString
|
masterstr = masters.join(","); // Make a comma-separated QString
|
||||||
|
|
||||||
qDebug() << "Masters" << masterstr;
|
|
||||||
|
|
||||||
// Iterate over all masters in the datafilesmodel to see if they are selected
|
// Iterate over all masters in the datafilesmodel to see if they are selected
|
||||||
for (int r=0; r<mDataFilesModel->rowCount(); ++r) {
|
for (int r=0; r<mDataFilesModel->rowCount(); ++r) {
|
||||||
QModelIndex currentIndex = mDataFilesModel->index(r, 0);
|
QModelIndex currentIndex = mDataFilesModel->index(r, 0);
|
||||||
|
@ -753,14 +737,8 @@ void DataFilesPage::masterSelectionChanged(const QItemSelection &selected, const
|
||||||
master.append("*");
|
master.append("*");
|
||||||
const QList<QStandardItem *> itemList = mDataFilesModel->findItems(master, Qt::MatchWildcard);
|
const QList<QStandardItem *> itemList = mDataFilesModel->findItems(master, Qt::MatchWildcard);
|
||||||
|
|
||||||
if (itemList.isEmpty())
|
|
||||||
qDebug() << "Empty as shit";
|
|
||||||
|
|
||||||
foreach (const QStandardItem *currentItem, itemList) {
|
foreach (const QStandardItem *currentItem, itemList) {
|
||||||
|
|
||||||
QModelIndex index = currentItem->index();
|
QModelIndex index = currentItem->index();
|
||||||
qDebug() << "Master to remove plugins of:" << index.data().toString();
|
|
||||||
|
|
||||||
removePlugins(index);
|
removePlugins(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -811,8 +789,6 @@ void DataFilesPage::removePlugins(const QModelIndex &index)
|
||||||
|
|
||||||
if (!itemList.isEmpty()) {
|
if (!itemList.isEmpty()) {
|
||||||
foreach (const QStandardItem *currentItem, itemList) {
|
foreach (const QStandardItem *currentItem, itemList) {
|
||||||
qDebug() << "Remove plugin:" << currentItem->data(Qt::DisplayRole).toString();
|
|
||||||
|
|
||||||
mPluginsModel->removeRow(currentItem->row());
|
mPluginsModel->removeRow(currentItem->row());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -886,8 +862,6 @@ void DataFilesPage::filterChanged(const QString filter)
|
||||||
|
|
||||||
void DataFilesPage::profileChanged(const QString &previous, const QString ¤t)
|
void DataFilesPage::profileChanged(const QString &previous, const QString ¤t)
|
||||||
{
|
{
|
||||||
qDebug() << "Profile changed " << current << previous;
|
|
||||||
|
|
||||||
if (!previous.isEmpty()) {
|
if (!previous.isEmpty()) {
|
||||||
writeConfig(previous);
|
writeConfig(previous);
|
||||||
mLauncherConfig->sync();
|
mLauncherConfig->sync();
|
||||||
|
@ -902,7 +876,6 @@ void DataFilesPage::profileChanged(const QString &previous, const QString &curre
|
||||||
void DataFilesPage::readConfig()
|
void DataFilesPage::readConfig()
|
||||||
{
|
{
|
||||||
QString profile = mProfilesComboBox->currentText();
|
QString profile = mProfilesComboBox->currentText();
|
||||||
qDebug() << "read from: " << profile;
|
|
||||||
|
|
||||||
// Make sure we have no groups open
|
// Make sure we have no groups open
|
||||||
while (!mLauncherConfig->group().isEmpty()) {
|
while (!mLauncherConfig->group().isEmpty()) {
|
||||||
|
@ -928,7 +901,6 @@ void DataFilesPage::readConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key.startsWith("Master")) {
|
if (key.startsWith("Master")) {
|
||||||
qDebug() << "Read master: " << keyValue;
|
|
||||||
const QList<QTableWidgetItem*> masterList = mMastersWidget->findItems(keyValue, Qt::MatchFixedString);
|
const QList<QTableWidgetItem*> masterList = mMastersWidget->findItems(keyValue, Qt::MatchFixedString);
|
||||||
|
|
||||||
if (!masterList.isEmpty()) {
|
if (!masterList.isEmpty()) {
|
||||||
|
@ -968,8 +940,6 @@ void DataFilesPage::writeConfig(QString profile)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << "Writing: " << profile;
|
|
||||||
|
|
||||||
// Make sure we have no groups open
|
// Make sure we have no groups open
|
||||||
while (!mLauncherConfig->group().isEmpty()) {
|
while (!mLauncherConfig->group().isEmpty()) {
|
||||||
mLauncherConfig->endGroup();
|
mLauncherConfig->endGroup();
|
||||||
|
@ -979,7 +949,6 @@ void DataFilesPage::writeConfig(QString profile)
|
||||||
mLauncherConfig->setValue("CurrentProfile", profile);
|
mLauncherConfig->setValue("CurrentProfile", profile);
|
||||||
|
|
||||||
// Open the profile-name subgroup
|
// Open the profile-name subgroup
|
||||||
qDebug() << "beginning group: " << profile;
|
|
||||||
mLauncherConfig->beginGroup(profile);
|
mLauncherConfig->beginGroup(profile);
|
||||||
mLauncherConfig->remove(""); // Clear the subgroup
|
mLauncherConfig->remove(""); // Clear the subgroup
|
||||||
|
|
||||||
|
|
|
@ -449,7 +449,6 @@ QStringList GraphicsPage::getAvailableOptions(const QString &key, Ogre::RenderSy
|
||||||
|
|
||||||
void GraphicsPage::rendererChanged(const QString &renderer)
|
void GraphicsPage::rendererChanged(const QString &renderer)
|
||||||
{
|
{
|
||||||
qDebug() << "renderer is " << renderer;
|
|
||||||
if (renderer.contains("Direct3D")) {
|
if (renderer.contains("Direct3D")) {
|
||||||
mRendererStackedWidget->setCurrentIndex(1);
|
mRendererStackedWidget->setCurrentIndex(1);
|
||||||
mDisplayStackedWidget->setCurrentIndex(1);
|
mDisplayStackedWidget->setCurrentIndex(1);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <components/files/path.hpp>
|
#include <components/files/path.hpp>
|
||||||
|
|
||||||
|
@ -198,12 +197,9 @@ void MainDialog::changePage(QListWidgetItem *current, QListWidgetItem *previous)
|
||||||
|
|
||||||
void MainDialog::closeEvent(QCloseEvent *event)
|
void MainDialog::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
qDebug() << "Close event";
|
|
||||||
|
|
||||||
// Now write all config files
|
// Now write all config files
|
||||||
writeConfig();
|
writeConfig();
|
||||||
event->accept();
|
event->accept();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainDialog::play()
|
void MainDialog::play()
|
||||||
|
@ -295,14 +291,10 @@ void MainDialog::writeConfig()
|
||||||
mGraphicsPage->writeConfig();
|
mGraphicsPage->writeConfig();
|
||||||
mGraphicsPage->mOgreConfig->sync();
|
mGraphicsPage->mOgreConfig->sync();
|
||||||
|
|
||||||
// Write to the openmw.cfg
|
|
||||||
//QString dataPath = mGameConfig->value("data").toString();
|
|
||||||
//dataPath.append("/");
|
|
||||||
|
|
||||||
QStringList dataFiles = mDataFilesPage->selectedMasters();
|
QStringList dataFiles = mDataFilesPage->selectedMasters();
|
||||||
dataFiles.append(mDataFilesPage->checkedPlugins());
|
dataFiles.append(mDataFilesPage->checkedPlugins());
|
||||||
|
|
||||||
qDebug() << "Writing to openmw.cfg";
|
qDebug("Writing to openmw.cfg");
|
||||||
|
|
||||||
// Open the config as a QFile
|
// Open the config as a QFile
|
||||||
QFile file(mGameConfig->fileName());
|
QFile file(mGameConfig->fileName());
|
||||||
|
@ -360,5 +352,4 @@ void MainDialog::writeConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
qDebug() << "Writing done!";
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,6 @@ class MainDialog : public QDialog
|
||||||
public:
|
public:
|
||||||
MainDialog();
|
MainDialog();
|
||||||
|
|
||||||
//QStringListModel *mProfileModel;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
void changePage(QListWidgetItem *current, QListWidgetItem *previous);
|
||||||
void play();
|
void play();
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
#include "pluginsview.hpp"
|
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <QSortFilterProxyModel>
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
|
#include "pluginsview.hpp"
|
||||||
|
|
||||||
PluginsView::PluginsView(QWidget *parent) : QTableView(parent)
|
PluginsView::PluginsView(QWidget *parent) : QTableView(parent)
|
||||||
{
|
{
|
||||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
@ -14,11 +13,8 @@ PluginsView::PluginsView(QWidget *parent) : QTableView(parent)
|
||||||
setDragDropMode(QAbstractItemView::InternalMove);
|
setDragDropMode(QAbstractItemView::InternalMove);
|
||||||
setDropIndicatorShown(true);
|
setDropIndicatorShown(true);
|
||||||
setDragDropOverwriteMode(false);
|
setDragDropOverwriteMode(false);
|
||||||
//viewport()->setAcceptDrops(true);
|
|
||||||
|
|
||||||
setContextMenuPolicy(Qt::CustomContextMenu);
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsView::startDrag(Qt::DropActions supportedActions)
|
void PluginsView::startDrag(Qt::DropActions supportedActions)
|
||||||
|
@ -28,16 +24,6 @@ void PluginsView::startDrag(Qt::DropActions supportedActions)
|
||||||
QAbstractItemView::startDrag( supportedActions );
|
QAbstractItemView::startDrag( supportedActions );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginsView::setModel(PluginsModel *model)
|
|
||||||
{
|
|
||||||
/*QTableView::setModel(model);
|
|
||||||
|
|
||||||
qRegisterMetaType< QVector<QPersistentModelIndex> >();
|
|
||||||
|
|
||||||
connect(model, SIGNAL(indexesDropped(QVector<QPersistentModelIndex>)),
|
|
||||||
this, SLOT(selectIndexes(QVector<QPersistentModelIndex>)), Qt::QueuedConnection);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void PluginsView::setModel(QSortFilterProxyModel *model)
|
void PluginsView::setModel(QSortFilterProxyModel *model)
|
||||||
{
|
{
|
||||||
QTableView::setModel(model);
|
QTableView::setModel(model);
|
||||||
|
|
|
@ -17,7 +17,6 @@ public:
|
||||||
{ return qobject_cast<PluginsModel*>(QAbstractItemView::model()); }
|
{ return qobject_cast<PluginsModel*>(QAbstractItemView::model()); }
|
||||||
|
|
||||||
void startDrag(Qt::DropActions supportedActions);
|
void startDrag(Qt::DropActions supportedActions);
|
||||||
void setModel(PluginsModel *model);
|
|
||||||
void setModel(QSortFilterProxyModel *model);
|
void setModel(QSortFilterProxyModel *model);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Loading…
Reference in a new issue