Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4GUI/TGo4RemoteBrowser.ui.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 ** ui.h extension file, included from the uic-generated form implementation.
00018 **
00019 ** If you wish to add, delete or rename slots use Qt Designer which will
00020 ** update this file, preserving your code. Create an init() slot in place of
00021 ** a constructor, and a destroy() slot in place of a destructor.
00022 *****************************************************************************/
00023 
00024 #include <iostream.h>
00025 
00026 void TGo4RemoteBrowser::init()
00027 {
00028    // TGo4LockGuard glob;
00029     fxDragItem=0;   
00030     TGo4GUIRegistry *fxTGo4GUIRegistry;
00031     fxTGo4GUIRegistry = TGo4GUIRegistry::Instance();
00032     fxTGo4RemoteBrowserSlots = (TGo4RemoteBrowserSlots *) fxTGo4GUIRegistry->GetSlotClass("TGo4RemoteBrowserSlots");
00033     if(fxTGo4RemoteBrowserSlots !=0) {
00034       fxTGo4RemoteBrowserSlots->SetGUI(this);
00035     }else{
00036       fxTGo4RemoteBrowserSlots = new TGo4RemoteBrowserSlots ("TGo4RemoteBrowserSlots", "Slots Class for Qt GUI", this);
00037     }
00038    fxTGo4RemoteBrowserStatus = (TGo4RemoteBrowserStatus *)  fxTGo4RemoteBrowserSlots->GetStatus();
00039 
00040    fxContextMenu = new QPopupMenu( ListViewRemote );
00041    Q_CHECK_PTR( fxContextMenu );
00042 
00043    fiMenuCopyID=fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "right" ), "Copy to local memory", this, SLOT(MoveRemoteToLocal()));
00044    fiMenuMonitorID=fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "monitor.png" ), "Send to monitoring list",  this, SLOT(MonitorRemoteHistogram()));
00045    fiMenuEditID=fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "control.png" ), "Edit...",  this, SLOT(EditSelected()));
00046    fiMenuPropertyID=fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "info.png" ), "Info...",  this, SLOT(ShowProperties()));
00047    fxContextMenu->insertSeparator();
00048    fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "clear.png" ), "Clear (Reset to 0)", this, SLOT(ResetRemoteObj()));
00049    fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "clear_nok.png" ), "Set Clear protection", this, SLOT(ResetProtectRemoteObject())); 
00050    fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "clear_ok.png" ), "Unset Clear protection", this, SLOT(ResetUnprotectRemoteObject())); 
00051    fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "delete.png" ), "Delete from analysis", this, SLOT(RemoveRemoteObject()));
00052    fxContextMenu->insertSeparator();
00053    fxContextMenu->insertItem(TGo4MainWindow::uic_load_pixmap( "refresh.png" ), "Refresh remote view", this, SLOT(Refresh())); 
00054  
00055 }
00056 
00057 
00058 void TGo4RemoteBrowser::ListViewRemote_selectionChanged()
00059 {
00060 //   // TGo4LockGuard glob;
00061 //    char buffer [256];
00062 //        QListViewItem *SelectedItem= ListViewRemote->selectedItem();
00063 //      if(SelectedItem!=0){
00064 //          if(SelectedItem->parent()!=0){
00065 //            sprintf(buffer,"%s/",SelectedItem->parent()->text(0).data());
00066 //          }
00067 //          strcat(buffer,SelectedItem->text(0));
00068 //          fxTGo4RemoteBrowserSlots->RemoteSelectionChanged(buffer);
00069 //      }
00070 }
00071 
00072 
00073 void TGo4RemoteBrowser::destroy()
00074 {
00075    ListViewRemote->clear();
00076 }
00077 
00078 void TGo4RemoteBrowser::Refresh()
00079 {
00080     // TGo4LockGuard glob;
00081    fxTGo4RemoteBrowserSlots->Refresh();
00082 }
00083 
00084 void TGo4RemoteBrowser::MonitorRemoteHistogram()
00085 {
00086    // TGo4LockGuard glob;
00087     QListViewItem *SelectedItem;
00088     SelectedItem = ListViewRemote->selectedItem();
00089     if(ListViewRemote->isMultiSelection())
00090         {
00091            QListViewItemIterator it(ListViewRemote);
00092            for ( ; it.current(); ++it ) {
00093               if ( it.current()->isSelected() ){
00094                  fxTGo4RemoteBrowserSlots->MonitorRemoteObj(it.current());
00095                  }
00096             }
00097            ListViewRemote->clearSelection();
00098         }
00099     else
00100         {
00101             if (SelectedItem !=0 )
00102                     fxTGo4RemoteBrowserSlots->MonitorRemoteObj(SelectedItem);
00103         }
00104 }
00105 
00106 void TGo4RemoteBrowser::RemoveRemoteObject()
00107 {
00108    // TGo4LockGuard glob;
00109    QListViewItem *SelectedItem;
00110    SelectedItem = ListViewRemote->selectedItem();
00111 
00112    if(ListViewRemote->isMultiSelection()){
00113       QListViewItemIterator it(ListViewRemote);
00114    // iterate through all items of the list view
00115    //   cout <<"GetObjectFromAnalysis MultipleSelectionMode" << endl;
00116           for ( ; it.current(); ++it ) {
00117                if ( it.current()->isSelected() ){
00118                fxTGo4RemoteBrowserSlots->RemoveObjectFromAnalysis(it.current());
00119             }
00120            }
00121    }else{
00122       if (SelectedItem !=0){
00123          fxTGo4RemoteBrowserSlots->RemoveObjectFromAnalysis(SelectedItem);
00124       }
00125    }
00126    ListViewRemote->clearSelection();
00127 
00128 }
00129 
00130 void TGo4RemoteBrowser::ResetRemoteObj()
00131 {
00132    // TGo4LockGuard glob;
00133     QListViewItem *SelectedItem;
00134     SelectedItem = ListViewRemote->selectedItem();
00135     if(ListViewRemote->isMultiSelection()){
00136       QListViewItemIterator it(ListViewRemote);
00137       // iterate through all items of the list view
00138        for ( ; it.current(); ++it ) {
00139           if ( it.current()->isSelected() ){
00140 
00141                 fxTGo4RemoteBrowserSlots->ResetRemoteObj(it.current()->text(0));
00142           }
00143       }
00144     }else{
00145       if (SelectedItem !=0){
00146 
00147           fxTGo4RemoteBrowserSlots->ResetRemoteObj(SelectedItem->text(0));
00148       }
00149     }
00150      ListViewRemote->clearSelection();
00151 }
00152 
00153 void TGo4RemoteBrowser::MoveRemoteToLocal()
00154 {
00155 // TGo4LockGuard glob;
00156     QListViewItem *SelectedItem;
00157    SelectedItem = ListViewRemote->selectedItem();
00158 
00159    if(ListViewRemote->isMultiSelection()){
00160       QListViewItemIterator it(ListViewRemote);
00161       // iterate through all items of the list view
00162    //   cout <<"GetObjectFromAnalysis MultipleSelectionMode" << endl;
00163           for ( ; it.current(); ++it ) {
00164                if ( it.current()->isSelected() ){
00165                    fxTGo4RemoteBrowserSlots->GetRemoteObj(it.current());
00166 
00167 //               TGo4QItem *fxTGo4QItem= dynamic_cast<TGo4QItem *> (it.current());
00168 //               if(fxTGo4QItem!=0) fxTGo4QItem->GetRemoteObj();
00169             }
00170            }
00171    }else{
00172       if (SelectedItem !=0){
00173 //         TGo4QItem *fxTGo4QItem= dynamic_cast<TGo4QItem *> (SelectedItem);
00174 //         if(fxTGo4QItem!=0) fxTGo4QItem->GetRemoteObj();
00175          fxTGo4RemoteBrowserSlots->GetRemoteObj(SelectedItem);
00176 
00177       }
00178    }
00179    ListViewRemote->clearSelection();
00180 }
00181 
00182 
00183 void TGo4RemoteBrowser::RemoteItemDoubleClicked( QListViewItem *Item )
00184 {
00185     // TGo4LockGuard glob;
00186     fxDragItem=0; // no start drag after double click
00187     TGo4QItem *fxTGo4QItem= dynamic_cast<TGo4QItem *> (Item);
00188    if(fxTGo4QItem!=0) fxTGo4QItem->ItemDBkRemote();
00189 
00190 }
00191 
00192 void TGo4RemoteBrowser::ClearRemoteList()
00193 {
00194     // TGo4LockGuard glob;
00195     ListViewRemote->clear();
00196     fxTGo4RemoteBrowserStatus->ClearRemoteList();
00197 }
00198 
00199 void TGo4RemoteBrowser::SetListFocus()
00200 {
00201     ListViewRemote->setFocus();
00202 }
00203 
00204 void TGo4RemoteBrowser::ListViewRemote_pressed( QListViewItem * SelectedItem)
00205 {
00206 fxDragItem=SelectedItem;
00207 int timems=QApplication::startDragTime();
00208 //cout <<"FileListView_pressed starts timer with "<<timems << endl;
00209 QTimer::singleShot( timems, this, SLOT(StartListviewDrag()) );         
00210 }
00211 
00212 void TGo4RemoteBrowser::ListViewRemote_clicked( QListViewItem * )
00213 {
00214    fxDragItem=0;// no drag start after click complete
00215 }
00216 
00217 void TGo4RemoteBrowser::StartListviewDrag()
00218 {
00219 if(fxDragItem==0) return;
00220 ListViewRemote->setCurrentItem(fxDragItem); // drop will always refer to currently selected item
00221 QDragObject *d = new QTextDrag(fxDragItem->text(0),ListViewRemote);
00222 d->dragCopy();
00223 fxDragItem=0;
00224 }
00225 
00226 void TGo4RemoteBrowser::ResetProtectRemoteObject()
00227 {
00228   QListViewItem *SelectedItem;
00229     SelectedItem = ListViewRemote->selectedItem();
00230     if(ListViewRemote->isMultiSelection()){
00231       QListViewItemIterator it(ListViewRemote);
00232       // iterate through all items of the list view
00233        for ( ; it.current(); ++it ) {
00234           if ( it.current()->isSelected() ){
00235                 fxTGo4RemoteBrowserSlots->ChangeProtectionsRemoteObj(it.current()->text(0),"+C");
00236           }
00237       }
00238     }else{
00239       if (SelectedItem !=0){
00240           fxTGo4RemoteBrowserSlots->ChangeProtectionsRemoteObj(SelectedItem->text(0),"+C");
00241       }
00242     }
00243     Refresh();
00244 }
00245 
00246 
00247 void TGo4RemoteBrowser::ResetUnprotectRemoteObject()
00248 {
00249  QListViewItem *SelectedItem;
00250     SelectedItem = ListViewRemote->selectedItem();
00251     if(ListViewRemote->isMultiSelection()){
00252       QListViewItemIterator it(ListViewRemote);
00253       // iterate through all items of the list view
00254        for ( ; it.current(); ++it ) {
00255           if ( it.current()->isSelected() ){
00256                 fxTGo4RemoteBrowserSlots->ChangeProtectionsRemoteObj(it.current()->text(0),"-C");
00257           }
00258       }
00259     }else{
00260       if (SelectedItem !=0){
00261 
00262           fxTGo4RemoteBrowserSlots->ChangeProtectionsRemoteObj(SelectedItem->text(0),"-C");
00263       }
00264     }
00265 Refresh();  
00266 }
00267 
00268 
00269 void TGo4RemoteBrowser::ListViewRemote_contextMenuRequested( QListViewItem* selitem, const QPoint& pt, int )
00270 {
00271 fxDragItem=0;// no drag start after context menu    
00272 if(selitem==0) return;
00273 bool canplot=((dynamic_cast<TGo4QTHItem*> (selitem)!=0)
00274                 || (dynamic_cast<TGo4QFolderItem*> (selitem)!=0)  );
00275 
00276 bool canedit = ( (dynamic_cast<TGo4QParaItem*> (selitem)!=0)
00277                 || (dynamic_cast<TGo4QConItem*> (selitem)!=0)
00278                 || (dynamic_cast<TGo4QFitterItem*> (selitem)!=0) 
00279                 || (dynamic_cast<TGo4QDynEntryItem*> (selitem)!=0));
00280 
00281 bool hasproperties = ( (dynamic_cast<TGo4QConItem*> (selitem)!=0)
00282                 || (dynamic_cast<TGo4QTH1Item*> (selitem)!=0)
00283                 || (dynamic_cast<TGo4QTH2Item*> (selitem)!=0)
00284                 || (dynamic_cast<TGo4QTH3Item*> (selitem)!=0) );
00285 
00286 fxContextMenu-> setItemEnabled (fiMenuCopyID,    canplot);
00287 fxContextMenu-> setItemEnabled (fiMenuMonitorID, canplot);
00288 fxContextMenu-> setItemEnabled (fiMenuEditID,    canedit);
00289 fxContextMenu-> setItemEnabled (fiMenuPropertyID, hasproperties);
00290 fxContextMenu->exec(pt);
00291 }
00292 
00293 
00294 void TGo4RemoteBrowser::ShowProperties()
00295 {
00296 QListViewItem *SelectedItem;
00297 SelectedItem = ListViewRemote->selectedItem();
00298 if(ListViewRemote->isMultiSelection())
00299     {
00300       QListViewItemIterator it(ListViewRemote);
00301        for ( ; it.current(); ++it ) 
00302         {
00303             if ( it.current()->isSelected() )
00304                 { 
00305                     ShowProperties(it.current());
00306                     break; // show only first selected
00307                 }
00308         }
00309     }
00310 else
00311     {
00312          if (SelectedItem !=0) ShowProperties(SelectedItem);  
00313     }
00314 }
00315 
00316 
00317 void TGo4RemoteBrowser::EditSelected()
00318 {
00319     QListViewItem *SelectedItem;
00320     SelectedItem = ListViewRemote->selectedItem();
00321     if(ListViewRemote->isMultiSelection())
00322         {
00323           QListViewItemIterator it(ListViewRemote);
00324            for ( ; it.current(); ++it ) 
00325             {
00326                 if ( it.current()->isSelected() ) RemoteItemDoubleClicked(it.current());
00327             }
00328         }
00329     else
00330         {
00331             if (SelectedItem !=0) RemoteItemDoubleClicked(SelectedItem);  
00332         }
00333 
00334 }   
00335 
00336 
00337 
00338 
00339 
00340 void TGo4RemoteBrowser::ShowProperties( QListViewItem * Item )
00341 {
00342    if(Item==0) return;
00343    TGo4MainWindow *mainwin = dynamic_cast <TGo4MainWindow *> (TGo4GUIRegistry::Instance()->GetMainWindow());
00344    QString iname=Item->text(0);
00345    if(dynamic_cast<TGo4QTH1Item*>(Item) || 
00346       dynamic_cast<TGo4QTH2Item*>(Item) ||
00347          dynamic_cast<TGo4QTH3Item*>(Item))
00348    {      
00349          TGo4HistogramInfo* hinfo=mainwin->HistogramInfoSlot(iname);
00350          
00351          
00352    }
00353    else if (dynamic_cast<TGo4QConItem*>(Item))
00354      {
00355          TGo4ConditionInfo* cinfo=mainwin->ConditionInfoSlot(iname);
00356    
00357      }            
00358    else
00359      cout <<"Requested Properties for unknown type item "<<iname.data() << endl;
00360 }
00361 
00362 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:56:02 2005 for Go4-v2.10-5 by doxygen1.2.15