Projects/ds4clonerestore/ds4clonerestore/src/restoreoutput.cpp

00001 /******************************************************
00002 * DS4 Clone-Restore
00003 *
00004 * DS4 Laser Technology srl
00005 *
00006 * author: Carsana Francesco <francescocarsana@ds4.it>
00007 *******************************************************/
00008 
00009 
00010 #include "restoreoutput.h"
00011 
00012 
00013 RestoreOutput::RestoreOutput(QWidget* parent, const char* name, WFlags fl)
00014         : restoreoutputdlg(parent,name,fl)
00015 {
00016     restoreWin = parent;
00017     txtOutput->setReadOnly(TRUE); // l'output non può essere editato
00018     txtOutput->setWordWrap(QTextEdit::NoWrap); // disattivo a capo automatico
00019     btnClose->setEnabled(FALSE); // disabilito il pulsante Close
00020 }
00021 
00022 
00023 RestoreOutput::~RestoreOutput()
00024 {}
00025 
00026 
00027 void RestoreOutput::appendOutput(const QString& text)
00028 {
00029     txtOutput->append(text); // appendo la stringa all'output
00030 }
00031 
00032 
00033 void RestoreOutput::appendError(const QString& text)
00034 {
00035     QColor color(255,0,0); // colore rosso
00036     txtOutput->setColor(color); // imposto il colore
00037     txtOutput->append(text); // appendo la stringa all'output
00038     color.setRgb(0,0,0);  // colore nero
00039     txtOutput->setColor(color);  // imposto il colore
00040 }
00041 
00042 
00043 void RestoreOutput::appendCommand(const QString& text)
00044 {
00045     txtOutput->setBold(TRUE); // imposto il grassetto
00046     txtOutput->append(text); // appendo la stringa all'output
00047     txtOutput->setBold(FALSE); // disabilito il grassetto
00048 }
00049 
00050 
00051 void RestoreOutput::btnClose_clicked()
00052 {
00053     this->Close(); // chiudo la finestra di visualizzazione output
00054 }
00055 
00056 
00057 void RestoreOutput::CloseEnabled()
00058 {
00059     btnClose->setEnabled(TRUE);
00060 }
00061 
00062 
00063 void RestoreOutput::closeEvent (QCloseEvent *e)
00064 {
00065     if (btnClose->isEnabled()) // se è abilitato il pulsante di chiusura
00066     {
00067         e->accept(); // accetto l'evento di chiusura
00068         this->Close(); // chiudo la finestra di visualizzazione output
00069     }
00070     else
00071     {
00072         e->ignore(); // ignoro il segnale di chiusura
00073     }
00074 }
00075 
00076 
00077 void RestoreOutput::Close()
00078 {
00079     this->hide(); // nascondo la finestra di visualizzazione output
00080     restoreWin->setEnabled( true ); // abilito la finestra di restore
00081     txtOutput->clear(); // cancello l'output prodotto
00082     btnClose->setEnabled(FALSE); // disabilito il pulsante Close
00083     qApp->notify(restoreWin, new QCloseEvent()); // notifico l'envento di chiusura al widget Restore
00084 }
00085 
00086 
00087 #include "restoreoutput.moc"

Generato il Wed Jun 13 18:59:37 2007 per DS4CloneRestore da  doxygen 1.5.2