Brief description of class still missing. More...
#include <FileView.h>
Public Slots | |
void | getSelection (SubSignalPool &sel) |
void | newGraphicWindow () |
void | newMapWindow () |
void | newTableWindow () |
void | newTool () |
void | remove () |
void | setSignalWindow (GeopsyMainWindow *sw) |
Public Member Functions | |
FileView (QWidget *parent=0) | |
SignalFileItem * | model () const |
void | refresh () |
virtual QSize | sizeHint () const |
Protected Member Functions | |
virtual void | contextMenuEvent (QContextMenuEvent *e) |
virtual void | mouseDoubleClickEvent (QMouseEvent *e) |
Protected Attributes | |
QAction * | _graphicAction |
QAction * | _mapAction |
QMenu * | _menu |
GeopsyMainWindow * | _sw |
QAction * | _tableAction |
Brief description of class still missing.
Full description of class still missing
FileView::FileView | ( | QWidget * | parent = 0 | ) |
Description of constructor still missing
References _menu, _sw, getSelection(), model(), SigSelectionDnD::setDropEnabled(), and TRACE.
: QTreeView(parent) { TRACE; SigSelectionDnD * sigDnD=new SigSelectionDnD(this); viewport() ->installEventFilter(sigDnD); sigDnD->setDropEnabled(false); connect(sigDnD, SIGNAL(getSelection( SubSignalPool& )), this, SLOT(getSelection( SubSignalPool& )) ); _sw=0; _menu=new QMenu(this); setContextMenuPolicy(Qt::DefaultContextMenu); SignalFileItem * model=new SignalFileItem(this); header()->hide(); setRootIsDecorated(false); setModel(model); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::ExtendedSelection); setEditTriggers(QAbstractItemView::NoEditTriggers); setColumnWidth(0,250); }
void FileView::contextMenuEvent | ( | QContextMenuEvent * | e | ) | [protected, virtual] |
References _graphicAction, _mapAction, _menu, _sw, _tableAction, ToolFactory::addPopularActions(), newTool(), GeopsyMainWindow::toolFactory(), QGpCoreTools::tr(), and TRACE.
{ TRACE; _menu->clear(); QModelIndex index=indexAt(e->pos()); if(index.isValid()) { QItemSelectionModel& sm=*selectionModel(); if(!sm.isSelected(index)) { sm.select(index, QItemSelectionModel::ClearAndSelect); } _menu->addAction(_tableAction); _menu->addAction(_graphicAction); _menu->addAction(_mapAction); _menu->addSeparator(); if(_sw->toolFactory() ->addPopularActions(_menu, this, SLOT(newTool())) ) { _menu->addSeparator(); } _menu->addAction(tr("Remove"), this, SLOT(remove()) ); _menu->popup(mapToGlobal( e->pos()) ); } }
void FileView::getSelection | ( | SubSignalPool & | sel | ) | [slot] |
References GeopsyGui::SignalFileItem::getSelection(), model(), and TRACE.
Referenced by FileView(), newGraphicWindow(), newMapWindow(), and newTableWindow().
{ TRACE; model()->getSelection(sel, *selectionModel()); }
SignalFileItem * FileView::model | ( | ) | const |
References TRACE.
Referenced by FileView(), getSelection(), refresh(), and remove().
{ TRACE; return static_cast<SignalFileItem *>(QTreeView::model()); }
void FileView::mouseDoubleClickEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
References newGraphicWindow(), and TRACE.
{ TRACE; QModelIndex index=indexAt(e->pos()); if(index.isValid()) newGraphicWindow(); }
void FileView::newGraphicWindow | ( | ) | [slot] |
References _sw, getSelection(), GeopsyMainWindow::newGraphicWindow(), and TRACE.
Referenced by mouseDoubleClickEvent(), newTool(), and setSignalWindow().
{ TRACE; SubSignalPool sel; getSelection(sel); _sw->newGraphicWindow(sel); }
void FileView::newMapWindow | ( | ) | [slot] |
References _sw, getSelection(), GeopsyMainWindow::newMapWindow(), and TRACE.
Referenced by setSignalWindow().
{ TRACE; SubSignalPool sel; getSelection(sel); _sw->newMapWindow(sel); }
void FileView::newTableWindow | ( | ) | [slot] |
References _sw, getSelection(), GeopsyMainWindow::newTableWindow(), and TRACE.
Referenced by setSignalWindow().
{ TRACE; SubSignalPool sel; getSelection(sel); _sw->newTableWindow(sel); }
void FileView::newTool | ( | ) | [slot] |
References _sw, newGraphicWindow(), ToolFactory::showTool(), GeopsyMainWindow::toolFactory(), and TRACE.
Referenced by contextMenuEvent().
{ TRACE; QAction * a=(QAction * ) sender(); if(a || a->inherits( "QAction" )) { QAction * original=*((QAction **) a->data().toByteArray().data()); newGraphicWindow(); _sw->toolFactory() ->showTool(original); } }
void FileView::refresh | ( | ) |
References GeopsyCore::GeopsyCoreEngine::currentDB(), GeopsyCore::geopsyCore, model(), GeopsyGui::SignalFileItem::setDatabase(), and TRACE.
Referenced by GeopsyMainWindow::clearAll(), GeopsyMainWindow::openDB(), GeopsyMainWindow::refreshLists(), GeopsyMainWindow::saveDB(), GeopsyMainWindow::saveDBAs(), and GeopsyMainWindow::showLoadedSignals().
{ TRACE; model()->setDatabase(geopsyCore->currentDB()); }
void FileView::remove | ( | ) | [slot] |
References _sw, GeopsyMainWindow::closeAllWindows(), GeopsyMainWindow::filesRemoved(), GeopsyGui::SignalFileItem::getSelection(), model(), MSG_ID, GeopsyGui::SignalFileItem::remove(), QGpCoreTools::tr(), TRACE, and GeopsyMainWindow::workspace().
{ TRACE; static const QString title=tr( "Removing files from database" ); QList<SignalFile *> fList; model()->getSelection(fList, *selectionModel()); if(fList.isEmpty()) { Message::warning(MSG_ID, title, tr( "No file selected for removal." ), Message::ok()); return; } QString fileListStr; for(QList<SignalFile *>::Iterator it=fList.begin();it!=fList.end();++it) { fileListStr+=((*it)->isOriginalFile() ? "\nO " : "\n ")+(*it)->name(); } if(Message::warning(MSG_ID, title, tr( "List of file(s) to remove:\n%1\n\n" "Original files (marked with 'O') will not be erased from disk. " "All other files automatically produced by Geopsy will be erased " "from the disk.\n\nDo you really want to remove these files?" ).arg(fileListStr), Message::no(), Message::yes())==Message::Answer0) return ; if(!_sw->workspace()->windowList().isEmpty()) { if(Message::warning(MSG_ID, title, tr("Closing all opened window is mandatory before removing " "a file. Do you want to close all windows?"), Message::no(), Message::yes())==Message::Answer0) return; _sw->closeAllWindows(); qApp->processEvents(QEventLoop::DeferredDeletion); // wait for all windows to be closed } _sw->filesRemoved(fList); model()->remove(fList); }
void FileView::setSignalWindow | ( | GeopsyMainWindow * | sw | ) | [slot] |
References _graphicAction, _mapAction, _sw, _tableAction, GeopsyMainWindow::newAction(), newGraphicWindow(), newMapWindow(), newTableWindow(), TRACE, GeopsyMainWindow::viewGraphicAction(), GeopsyMainWindow::viewMapAction(), and GeopsyMainWindow::viewTableAction().
Referenced by GeopsyMainWindow::setToolFactory().
{ TRACE; _sw=sw; // Create actions _tableAction=GeopsyMainWindow::newAction( *_sw->viewTableAction(), this); connect(_tableAction, SIGNAL(triggered()), this, SLOT(newTableWindow()) ); _graphicAction=GeopsyMainWindow::newAction( *_sw->viewGraphicAction(), this); connect(_graphicAction, SIGNAL(triggered()), this, SLOT(newGraphicWindow()) ); _mapAction=GeopsyMainWindow::newAction( *_sw->viewMapAction(), this); connect(_mapAction, SIGNAL(triggered()), this, SLOT(newMapWindow()) ); }
QSize FileView::sizeHint | ( | ) | const [virtual] |
QAction* FileView::_graphicAction [protected] |
Referenced by contextMenuEvent(), and setSignalWindow().
QAction* FileView::_mapAction [protected] |
Referenced by contextMenuEvent(), and setSignalWindow().
QMenu* FileView::_menu [protected] |
Referenced by contextMenuEvent(), and FileView().
GeopsyMainWindow* FileView::_sw [protected] |
Referenced by contextMenuEvent(), FileView(), newGraphicWindow(), newMapWindow(), newTableWindow(), newTool(), remove(), and setSignalWindow().
QAction* FileView::_tableAction [protected] |
Referenced by contextMenuEvent(), and setSignalWindow().