inheriting Merge from QWidget instead of QDialog, because QDialog is bloody useless for non-modal dialogues (which makes the class completely useless, since modal dialogues are the spawn of Satan)

sceneinput
Marc Zinnschlag 10 years ago
parent 904ad94952
commit e2377396a7

@ -379,4 +379,6 @@ void CS::Editor::mergeDocument (CSMDoc::Document *document)
{
mMerge.configure (document);
mMerge.show();
mMerge.raise();
mMerge.activateWindow();
}

@ -7,14 +7,26 @@
#include <QPushButton>
#include <QListWidget>
#include <QLabel>
#include <QKeyEvent>
#include "../../model/doc/document.hpp"
#include "../doc/filewidget.hpp"
#include "../doc/adjusterwidget.hpp"
void CSVTools::Merge::keyPressEvent (QKeyEvent *event)
{
if (event->key()==Qt::Key_Escape)
{
event->accept();
cancel();
}
else
QWidget::keyPressEvent (event);
}
CSVTools::Merge::Merge (QWidget *parent)
: QDialog (parent), mDocument (0)
: QWidget (parent), mDocument (0)
{
setWindowTitle ("Merge Content Files into a new Game File");
@ -65,7 +77,7 @@ CSVTools::Merge::Merge (QWidget *parent)
// buttons
QDialogButtonBox *buttons = new QDialogButtonBox (QDialogButtonBox::Cancel, Qt::Horizontal, this);
connect (buttons->button (QDialogButtonBox::Cancel), SIGNAL (clicked()), this, SLOT (reject()));
connect (buttons->button (QDialogButtonBox::Cancel), SIGNAL (clicked()), this, SLOT (cancel()));
mOkay = new QPushButton ("Merge", this);
connect (mOkay, SIGNAL (clicked()), this, SLOT (accept()));
@ -110,8 +122,6 @@ void CSVTools::Merge::cancel()
void CSVTools::Merge::accept()
{
QDialog::accept();
if ((mDocument->getState() & CSMDoc::State_Merging)==0)
{
mDocument->runMerge (mAdjuster->getPath());
@ -119,12 +129,6 @@ void CSVTools::Merge::accept()
}
}
void CSVTools::Merge::reject()
{
QDialog::reject();
cancel();
}
void CSVTools::Merge::stateChanged (bool valid)
{
mOkay->setEnabled (valid);

@ -1,7 +1,7 @@
#ifndef CSV_TOOLS_REPORTTABLE_H
#define CSV_TOOLS_REPORTTABLE_H
#include <QDialog>
#include <QWidget>
#include <boost/filesystem/path.hpp>
@ -21,7 +21,7 @@ namespace CSVDoc
namespace CSVTools
{
class Merge : public QDialog
class Merge : public QWidget
{
Q_OBJECT
@ -31,6 +31,8 @@ namespace CSVTools
CSVDoc::FileWidget *mNewFile;
CSVDoc::AdjusterWidget *mAdjuster;
void keyPressEvent (QKeyEvent *event);
public:
Merge (QWidget *parent = 0);
@ -42,18 +44,15 @@ namespace CSVTools
CSMDoc::Document *getDocument() const;
void cancel();
public slots:
virtual void accept();
virtual void reject();
void cancel();
private slots:
void stateChanged (bool valid);
void accept();
void stateChanged (bool valid);
};
}

Loading…
Cancel
Save