#include <QtGui>
#include "Dialog.h"
#include "ConvertDialog.h"
{
ui.setupUi(this);
connect(pushButton, SIGNAL(clicked()), this, SLOT(convertDialog::settingUp()));
}
{
ui.setupUi(this);
}
bool convertDialog::settingUp()
{
if (beaufortBox->isChecked() && beaufortBox_2->isChecked())
{
int ret
= QMessageBox::information(this, tr
("Speed Units Converter"),
tr("You can't convert value to the same unit"),
{
return false;
}
}
if (knotBox->isChecked() && knotBox_2->isChecked())
{
int ret
= QMessageBox::information(this, tr
("Speed Units Converter"),
tr("You can't convert value to the same unit"),
{
return false;
}
}
if (mpsBox->isChecked() && mpsBox_2->isChecked())
{
int ret
= QMessageBox::information(this, tr
("Speed Units Converter"),
tr("You can't convert value to the same unit"),
{
return false;
}
}
if (kphBox->isChecked() && kphBox_2->isChecked())
{
int ret
= QMessageBox::information(this, tr
("Speed Units Converter"),
tr("You can't convert value to the same unit"),
{
return false;
}
}
if (mphBox->isChecked() && mphBox_2->isChecked())
{
int ret
= QMessageBox::information(this, tr
("Speed Units Converter"),
tr("You can't convert value to the same unit"),
{
return false;
}
}
if (beaufortBox->isChecked() && knotBox_2->isChecked())
{
convertDialog->setWindowTitle("Converting value from Beaufort to Knot");
toLabel->setText("Knot(s)");
Dialog::displayConvertDialog();
}
if (beaufortBox->isChecked() && mpsBox_2->isChecked())
{
convertDialog->setWindowTitle("Converting value from Beaufort to Mps");
Dialog::displayConvertDialog();
}
/...and many the same looking
}
if (mphBox->isChecked() && kphBox_2->isChecked())
{
convertDialog->setWindowTitle("Converting value from Kph to Kph");
fromLabel->setText("Mile(s) per hour it's");
toLabel->setText("Kilometer(s) per hour");
Dialog::displayConvertDialog();
}
}
void Dialog::displayConvertDialog()
{
convertDialog dlg( this );
dlg.exec();
}
#include <QtGui>
#include "Dialog.h"
#include "ConvertDialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
connect(pushButton, SIGNAL(clicked()), this, SLOT(convertDialog::settingUp()));
}
convertDialog(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
}
bool convertDialog::settingUp()
{
if (beaufortBox->isChecked() && beaufortBox_2->isChecked())
{
int ret = QMessageBox::information(this, tr("Speed Units Converter"),
tr("You can't convert value to the same unit"),
QMessageBox::Ok | QMessageBox::Default);
if (ret == QMessageBox::Ok)
{
return false;
}
}
if (knotBox->isChecked() && knotBox_2->isChecked())
{
int ret = QMessageBox::information(this, tr("Speed Units Converter"),
tr("You can't convert value to the same unit"),
QMessageBox::Ok | QMessageBox::Default);
if (ret == QMessageBox::Ok)
{
return false;
}
}
if (mpsBox->isChecked() && mpsBox_2->isChecked())
{
int ret = QMessageBox::information(this, tr("Speed Units Converter"),
tr("You can't convert value to the same unit"),
QMessageBox::Ok | QMessageBox::Default);
if (ret == QMessageBox::Ok)
{
return false;
}
}
if (kphBox->isChecked() && kphBox_2->isChecked())
{
int ret = QMessageBox::information(this, tr("Speed Units Converter"),
tr("You can't convert value to the same unit"),
QMessageBox::Ok | QMessageBox::Default);
if (ret == QMessageBox::Ok)
{
return false;
}
}
if (mphBox->isChecked() && mphBox_2->isChecked())
{
int ret = QMessageBox::information(this, tr("Speed Units Converter"),
tr("You can't convert value to the same unit"),
QMessageBox::Ok | QMessageBox::Default);
if (ret == QMessageBox::Ok)
{
return false;
}
}
if (beaufortBox->isChecked() && knotBox_2->isChecked())
{
convertDialog->setWindowTitle("Converting value from Beaufort to Knot");
toLabel->setText("Knot(s)");
Dialog::displayConvertDialog();
}
if (beaufortBox->isChecked() && mpsBox_2->isChecked())
{
convertDialog->setWindowTitle("Converting value from Beaufort to Mps");
Dialog::displayConvertDialog();
}
/...and many the same looking
}
if (mphBox->isChecked() && kphBox_2->isChecked())
{
convertDialog->setWindowTitle("Converting value from Kph to Kph");
fromLabel->setText("Mile(s) per hour it's");
toLabel->setText("Kilometer(s) per hour");
Dialog::displayConvertDialog();
}
}
void Dialog::displayConvertDialog()
{
convertDialog dlg( this );
dlg.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks