Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4LogInfo.ui.h

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 
00017 void TGo4LogInfo::init()
00018 {
00019    setAcceptDrops(FALSE);
00020    infoIcon = QPixmap::fromMimeSource("info.png");
00021    errorIcon = QPixmap::fromMimeSource("error.png");
00022    warnIcon = QPixmap::fromMimeSource("warn.png");
00023 
00024    LogText->setSorting(0, FALSE);
00025 }
00026 
00027 void TGo4LogInfo::WorkWithInfo(TGo4Slot* slot)
00028 {
00029     ResetWidget();
00030     AddLink(slot, "Loginfo");
00031 }
00032 
00033 void TGo4LogInfo::linkedObjectUpdated( const char * linkname, TObject * obj )
00034 {
00035    if (obj==0) return;
00036 
00037    QDateTime dt = QDateTime::currentDateTime();
00038    QString Name = obj->GetName();
00039    QString Date = dt.toString("dd.MM.yy  ");
00040    QString Time = dt.toString("hh.mm.ss  ");
00041 
00042    QListViewItem *Item = new QListViewItem(LogText, Date, Time);
00043    if(Name.contains("GO4-*")) {
00044       Item->setText(3, "Info");
00045       Item->setPixmap(0, infoIcon);
00046     } else if (Name.contains("GO4-!")) {
00047       Item->setText(3, "Error");
00048       Item->setPixmap(0, errorIcon);
00049     } else if(Name.contains("GO4-#")) {
00050       Item->setText(3, "Warning");
00051       Item->setPixmap(0, warnIcon);
00052       }
00053     Name.remove(0, 6);
00054     Item->setText(2, Name);
00055     LogText->setSelected(Item, true);
00056 }
00057 
00058 
00059 void TGo4LogInfo::ClearLogInfo()
00060 {
00061    LogText->clear();
00062 }
00063 
00064 void TGo4LogInfo::SaveLogInfo()
00065 {
00066     QString TextToSave;
00067     QFileDialog fd( this, "Save Log Information", TRUE );
00068     fd.setMode( QFileDialog::AnyFile );
00069     fd.setName( "Save Log Information ");
00070     fd.setCaption( "Save analysis log window");
00071     fd.setFilter( "Plain text (*.txt)" );
00072     if ( fd.exec() != QDialog::Accepted ) return;
00073 
00074     QString fileName = fd.selectedFile();
00075     if(!fileName.endsWith(".txt")) fileName.append(".txt");
00076     QFile NewFile(fileName);
00077     NewFile.open( IO_ReadWrite | IO_Append );
00078     QTextStream t( &NewFile );
00079 
00080     QListViewItemIterator it(LogText);
00081       // iterate through all items of the list view
00082     for ( ; it.current(); ++it ) {
00083        QListViewItem* itm = it.current();
00084        t << itm->text(0) << " " << itm->text(1) << " " << itm->text(2) << endl;
00085     }
00086     NewFile.close();
00087 }
00088 
00089 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:21 2008 for Go4-v3.04-1 by  doxygen 1.4.2