warningdialog.cpp
author anng888
Thu, 06 Dec 2007 18:43:23 +0000
changeset 633 dad2c8993342
parent 443 0a4b622d5dc3
permissions -rw-r--r--
- Make the Win32 call to "unzip" use a minimized window.
- Clean up process and thread handles from "unzip".
     1 #include "warningdialog.h"
     2 #include "settings.h"
     3 
     4 extern QString iconPath;
     5 extern Settings settings;
     6 
     7 WarningDialog::WarningDialog(QWidget* parent):QDialog (parent)
     8 {
     9     ui.setupUi(this);
    10 	//TODO proper icon for proceed needed
    11 	ui.okButton->setText(tr("Proceed"));
    12 	/*
    13 	ui.warningSign->setPixmap (QPixmap(iconPath + "icons/vym.png"));
    14 	*/
    15 	ui.showAgainBox->setText (tr("Show this message again"));
    16 	useShowAgain=false;
    17 	ui.showAgainBox->hide();
    18 }
    19 
    20 int WarningDialog::exec()
    21 {
    22 	int result; 
    23 	if (settings.value ("/warningDialog/"+showAgainName+"/showAgain",true).toBool()  )
    24 	{
    25 		result=QDialog::exec();
    26 		if (result==QDialog::Accepted )
    27 		{
    28 			settings.setValue ("/warningDialog/"+showAgainName+"/value",result);
    29 			settings.setValue ("/warningDialog/"+showAgainName+"/showAgain",ui.showAgainBox->isChecked() );
    30 		}
    31 	} else
    32 	{
    33 		result=settings.value ("/warningDialog/"+showAgainName+"/value",0).toInt();
    34 	}
    35 	return result;
    36 }
    37 
    38 void WarningDialog::showCancelButton (bool b)
    39 {
    40 	if (b)
    41 	{
    42 		ui.cancelButton->show();
    43 		ui.cancelButton->setText(tr("Cancel"));
    44 	} else
    45 		ui.cancelButton->hide();
    46 }
    47 
    48 void WarningDialog::setShowAgainName (const QString &s) 
    49 {
    50 	showAgainName=s;
    51 	useShowAgain=true;
    52 	ui.showAgainBox->show();
    53 }
    54 
    55 void WarningDialog::setText (const QString &s)
    56 {
    57 	ui.warningTE->setText(s);
    58 }
    59 
    60 void WarningDialog::setCaption(const QString &s)
    61 {
    62 	QDialog::setCaption("VYM - "+s);
    63 }