Skip to content

Commit

Permalink
Initial import of WMIT into git.
Browse files Browse the repository at this point in the history
  • Loading branch information
Safety0ff committed Oct 5, 2010
1 parent 172a5da commit bdecff9
Show file tree
Hide file tree
Showing 57 changed files with 8,382 additions and 0 deletions.
674 changes: 674 additions & 0 deletions COPYING.txt

Large diffs are not rendered by default.

92 changes: 92 additions & 0 deletions ConfigDialog.cpp
@@ -0,0 +1,92 @@
/*
Copyright 2010 Warzone 2100 Project
This file is part of WMIT.
WMIT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
WMIT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with WMIT. If not, see <http://www.gnu.org/licenses/>.
*/

#include "ConfigDialog.hpp"
#include "ui_ConfigDialog.h"

#include <QFileDialog>

ConfigDialog::ConfigDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConfigDialog)
{
ui->setupUi(this);
ui->lw_dirs->setSelectionMode(QAbstractItemView::MultiSelection);
}

ConfigDialog::~ConfigDialog()
{
delete ui;
}

void ConfigDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}

void ConfigDialog::setTextureSearchDirs(QStringList dirs)
{
ui->lw_dirs->clear();
ui->lw_dirs->addItems(dirs);
}

void ConfigDialog::on_pb_add_clicked()
{
QFileDialog* fileDialog = new QFileDialog(this);
fileDialog->setWindowTitle(tr("Select texture search directory."));
fileDialog->setFileMode(QFileDialog::Directory);
fileDialog->setFilter("*.png");
fileDialog->exec();
if (fileDialog->result() == QDialog::Accepted)
{
foreach (QString dir, fileDialog->selectedFiles())
{
searchDirChanges.append(qMakePair(true, dir));
ui->lw_dirs->addItem(dir);
}
}
delete fileDialog;
}

void ConfigDialog::on_pb_remove_clicked()
{
foreach(QListWidgetItem* item, ui->lw_dirs->selectedItems())
{
searchDirChanges.append(qMakePair(false, item->text()));
delete ui->lw_dirs->takeItem(ui->lw_dirs->row(item));
}
}

void ConfigDialog::on_buttonBox_accepted()
{
emit updateTextureSearchDirs(searchDirChanges);
searchDirChanges.clear();
}

void ConfigDialog::on_buttonBox_rejected()
{
searchDirChanges.clear();
}
57 changes: 57 additions & 0 deletions ConfigDialog.hpp
@@ -0,0 +1,57 @@
/*
Copyright 2010 Warzone 2100 Project
This file is part of WMIT.
WMIT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
WMIT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with WMIT. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CONFIGDIALOG_HPP
#define CONFIGDIALOG_HPP

#include <QDialog>

#include <QList>
#include <QPair>
#include <QString>

namespace Ui {
class ConfigDialog;
}

class ConfigDialog : public QDialog {
Q_OBJECT
public:
ConfigDialog(QWidget *parent = 0);
~ConfigDialog();

protected:
void changeEvent(QEvent *e);

private:
Ui::ConfigDialog *ui;
QList<QPair<bool,QString> > searchDirChanges;
signals:
void updateTextureSearchDirs(QList<QPair<bool,QString> >);

public slots:
void setTextureSearchDirs(QStringList);

private slots:
void on_buttonBox_rejected();
void on_buttonBox_accepted();
void on_pb_remove_clicked();
void on_pb_add_clicked();
};

#endif // CONFIGDIALOG_HPP
120 changes: 120 additions & 0 deletions ConfigDialog.ui
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigDialog</class>
<widget class="QDialog" name="ConfigDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>398</width>
<height>301</height>
</rect>
</property>
<property name="windowTitle">
<string>Config</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Texture search directories</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QListWidget" name="lw_dirs"/>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pb_add">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pb_remove">
<property name="text">
<string>Remove</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>ConfigDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>ConfigDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
55 changes: 55 additions & 0 deletions ExportDialog.cpp
@@ -0,0 +1,55 @@
/*
Copyright 2010 Warzone 2100 Project
This file is part of WMIT.
WMIT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
WMIT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with WMIT. If not, see <http://www.gnu.org/licenses/>.
*/

#include "ExportDialog.hpp"
#include "ui_ExportDialog.h"

ExportDialog::ExportDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ExportDialog)
{
ui->setupUi(this);
}

ExportDialog::~ExportDialog()
{
delete ui;
}

void ExportDialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}

int ExportDialog::optimisationSelected() const
{
return ui->comboBox->currentIndex();
}

PieExportDialog::PieExportDialog(QWidget* parent)
: ExportDialog(parent)
{
}
51 changes: 51 additions & 0 deletions ExportDialog.hpp
@@ -0,0 +1,51 @@
/*
Copyright 2010 Warzone 2100 Project
This file is part of WMIT.
WMIT is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
WMIT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with WMIT. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef EXPORTDIALOG_HPP
#define EXPORTDIALOG_HPP

#include <QDialog>

namespace Ui {
class ExportDialog;
}

class ExportDialog : public QDialog {
Q_OBJECT
public:
ExportDialog(QWidget *parent = 0);
~ExportDialog();

int optimisationSelected() const;
protected:
void changeEvent(QEvent *e);

private:
Ui::ExportDialog *ui;
};

class PieExportDialog : public ExportDialog
{
Q_OBJECT
public:
PieExportDialog(QWidget* parent = NULL);
private:
};

#endif // EXPORTDIALOG_HPP

0 comments on commit bdecff9

Please sign in to comment.