00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 void TGo4LogInfo::init()
00017 {
00018 TGo4GUIRegistry *fxTGo4GUIRegistry;
00019 fxTGo4GUIRegistry = TGo4GUIRegistry::Instance();
00020 fxTGo4LogInfoSlots = (TGo4LogInfoSlots *) fxTGo4GUIRegistry->GetSlotClass("TGo4LogInfoSlots");
00021 if(fxTGo4LogInfoSlots !=0) {
00022 fxTGo4LogInfoSlots->SetGUI(this);
00023 fxTGo4LogInfoSlots->RestoreInfo();
00024 } else {
00025 fxTGo4LogInfoSlots = new TGo4LogInfoSlots ("TGo4LogInfoSlots", "Slots Class for Qt GUI", this);
00026 }
00027 fxTGo4LogInfoStatus = (TGo4LogInfoStatus *) fxTGo4LogInfoSlots->GetStatus();
00028 LogText->setSorting(0,false);
00029
00030
00031 infoIcon = TGo4MainWindow::uic_load_pixmap( "info.png" );
00032 errorIcon = TGo4MainWindow::uic_load_pixmap( "error.png" );
00033 warnIcon = TGo4MainWindow::uic_load_pixmap( "warn.png" );
00034 }
00035
00036 void TGo4LogInfo::destroy()
00037 {
00038 LogText->clear();
00039 fxTGo4LogInfoSlots->SetGUI(0);
00040 }
00041
00042 void TGo4LogInfo::NewText( QString Name, QString Date, QString Time)
00043 {
00044
00045
00046 QListViewItem *Item = new QListViewItem(LogText, Date, Time);
00047 if(Name.contains("GO4-*")) {
00048 Item->setText(3, "Info");
00049 Item->setPixmap( 0, infoIcon);
00050 } else if (Name.contains("GO4-!")) {
00051 Item->setText(3, "Error");
00052 Item->setPixmap( 0, errorIcon);
00053 } else if(Name.contains("GO4-#")) {
00054 Item->setText(3, "Warning");
00055 Item->setPixmap( 0, warnIcon );
00056 }
00057 Name.remove(0, 6);
00058
00059 Item->setText(2, Name);
00060
00061 LogText->setSelected(Item, true);
00062 }
00063
00064 void TGo4LogInfo::closeEvent( QCloseEvent *e )
00065 {
00066 e->accept();
00067 delete this;
00068 }
00069
00070
00071 void TGo4LogInfo::ClearText()
00072 {
00073 LogText->clear();
00074 fxTGo4LogInfoStatus->ClearLogInfo();
00075 }
00076
00077 void TGo4LogInfo::SaveText()
00078 {
00079 QString TextToSave;
00080 QFileDialog* fd = new QFileDialog( this, "Save Log Information", TRUE );
00081 fd->setMode( QFileDialog::AnyFile );
00082 fd->setName( "Save Log Information ");
00083 fd->setCaption( "Save analysis log window");
00084 fd->setFilter( "Plain text (*.txt)" );
00085 if ( fd->exec() == QDialog::Accepted ){
00086 QString fileName=fd->selectedFile();
00087 if(!fileName.endsWith(".txt")) fileName.append(".txt");
00088 QFile NewFile(fileName);
00089 NewFile.open( IO_ReadWrite | IO_Append );
00090 QTextStream t( &NewFile );
00091 TObject *entry = 0;
00092 TIter iter(fxTGo4LogInfoStatus->GetLogInfo());
00093 while((entry = iter()) !=0) {
00094 TextToSave.truncate(0);
00095 TGo4LogInfoObject* fxTGo4LogInfoObject = dynamic_cast<TGo4LogInfoObject *> (entry);
00096 if (fxTGo4LogInfoObject==0) continue;
00097 QString Name = fxTGo4LogInfoObject->GetName();
00098 QString Date = fxTGo4LogInfoObject->GetLogDate();
00099 QString Time = fxTGo4LogInfoObject->GetLogTime();
00100 TextToSave.append(Date);
00101 TextToSave.append(Time);
00102 TextToSave.append(Name);
00103 t <<TextToSave << endl;
00104 }
00105 NewFile.close();
00106 }
00107 delete fd;
00108 }
00109
00110
00111