28 #ifdef BALL_PYTHON_SUPPORT
35 #include <BALL/COMMON/version.h>
37 #include <QtGui/QKeyEvent>
38 #include <QtGui/QTreeWidget>
45 #include "ui_aboutDialog.h"
60 using namespace BALL::VIEW;
62 Mainframe::Mainframe(
QWidget* parent,
const char* name)
66 #ifdef BALL_VIEW_DEBUG
67 Log.
error() <<
"new Mainframe " <<
this << std::endl;
73 setWindowTitle(tr(
"BALLView"));
82 #ifdef BALL_PYTHON_SUPPORT
97 String description =
"Shortcut|Display|Toggle_Fullscreen";
115 addDockWidget(Qt::LeftDockWidgetArea,
new GeometricControl(
this, ((
String)tr(
"Representations")).c_str()));
116 addDockWidget(Qt::TopDockWidgetArea,
new DatasetControl(
this, ((
String)tr(
"Datasets")).c_str()));
126 DatasetControl::getInstance(0)->hide();
133 addDockWidget(Qt::BottomDockWidgetArea,
new HelpViewer(
this,
"BALLView Docu"));
136 addDockWidget(Qt::BottomDockWidgetArea,
new LogView(
this, ((
String)tr(
"Logs")).c_str()));
137 addDockWidget(Qt::BottomDockWidgetArea,
new FileObserver(
this, ((
String)tr(
"FileObserver")).c_str()));
143 setAcceptDrops(
true);
155 #ifdef BALL_PYTHON_SUPPORT
157 addDockWidget(Qt::BottomDockWidgetArea,
new PyWidget(
this, ((
String)tr(
"Python Interpreter")).c_str()));
164 description =
"Shortcut|File|Open|Project";
169 description =
"Shortcut|File|Save_Project";
177 description =
"Shortcut|Help|About";
180 setMenuHint(action, (
String)tr(
"Show informations on this version of BALLView"));
182 description =
"Shortcut|Help|How_to_cite";
189 description =
"Shortcut|MolecularMechanics|Abort_Calculation";
203 description =
"Shortcut|Edit|Invert_Selection";
208 description =
"Shortcut|Edit|Clear_Selection";
214 qApp->installEventFilter(
this);
226 if (event->type() != QEvent::KeyPress)
return false;
228 QKeyEvent* e =
dynamic_cast<QKeyEvent*
>(
event);
230 if (e->key() == Qt::Key_Escape &&
231 HelpViewer::getInstance(
"BALLView Docu")->isWhatsThisEnabled())
233 HelpViewer::getInstance(
"BALLView Docu")->exitWhatsThisMode();
236 QPoint point = QCursor::pos();
237 QWidget* widget = qApp->widgetAt(point);
239 qApp->focusWidget() !=
scene_)
245 if (e->key() == Qt::Key_Delete &&
246 RTTI::isKindOf<QTreeWidget>(*sender))
252 if (e->key() == Qt::Key_Enter)
261 MolecularStructure::getInstance(0)->centerCamera();
266 if (e->key() == Qt::Key_Alt ||
267 e->key() == Qt::Key_Control)
273 #ifdef BALL_PYTHON_SUPPORT
274 PyWidget::getInstance(0)->reactTo(*e);
300 HelpViewer::getInstance(
"BALLView Docu")->showHelp(
"tips.html", (
String)tr(
"cite"));
315 tb =
new QToolBar(
"Main Toolbar",
this);
316 tb->setObjectName(
"Main Toolbar");
317 tb->setIconSize(QSize(22,22));
318 addToolBar(Qt::TopToolBarArea, tb);
327 menu->addSeparator();
328 menu->addAction(tb->toggleViewAction());
334 MolecularFileDialog::getInstance(0)->addToolBarEntries(tb);
335 DownloadPDBFile::getInstance(0)->addToolBarEntries(tb);
336 DownloadElectronDensity::getInstance(0)->addToolBarEntries(tb);
337 PubChemDialog::getInstance(0)->addToolBarEntries(tb);
338 UndoManagerDialog::getInstance(0)->addToolBarEntries(tb);
347 HelpViewer::getInstance(
"BALLView Docu")->registerForHelpSystem(
qload_action_,
"tips.html#quickload");
353 HelpViewer::getInstance(
"BALLView Docu")->registerForHelpSystem(
qsave_action_,
"tips.html#quickload");
357 DisplayProperties::getInstance(0)->addToolBarEntries(tb);
358 MolecularStructure::getInstance(0)->addToolBarEntries(tb);
367 HelpViewer::getInstance(
"BALLView Docu")->addToolBarEntries(tb);
378 Ui_AboutDialog
about;
380 QString version = QString(tr(
"QT ")) + qVersion();
381 #ifdef BALL_QT_HAS_THREADS
384 about.qt_version_label->setText(version);
385 QFont font = about.BALLView_version_label->font();
386 about.BALLView_version_label->setText(QString(
"BALLView ") + BALL_RELEASE_STRING);
387 font.setPixelSize(18);
388 about.BALLView_version_label->setFont(font);
389 about.BALL_version_label->setText(__DATE__);
393 String logo_path = p.
find(
"graphics/logo.png");
396 about.BALLView_logo_label->setPixmap(QPixmap(logo_path.
c_str()));
403 if(evt->type() == QEvent::WindowStateChange) {
CompositeManager composite_manager_
RepresentationManager & getRepresentationManager()
QAction * preferences_action_
void insertPopupMenuSeparator(int ID, UIOperationMode::OperationMode mode=UIOperationMode::MODE_ALL)
Preferences * getPreferences()
void loadBALLViewProjectFile()
void setupPluginHandlers_()
bool eventFilter(QObject *, QEvent *e)
Catch key events.
void stopSimulation()
Stop a currently running calculation.
void setSurfaceDrawingPrecision(float value)
std::list< Composite * > & getMolecularControlSelection()
Get the selection (highlighted items) of the MolecularControl (not the selection with checkboxes) ...
CompositeIterator begin()
Display Viewpoint submenu.
QAction * fullscreen_action_
Size getNumberOfComposites() const
QAction * clear_selection_action_
void setDrawingPrecision(int value)
void saveBALLViewProjectFile()
virtual void deleteClicked()
static PluginManager & instance()
QAction * stop_simulation_action_
void complementSelection()
BALL_EXPORT LogStream Log
void setMenuHint(QAction *id, const String &hint)
Set a hint for a menu entry.
void setStatusbarText(const String &text, bool important=false, bool beep=false)
static bool stereoBufferSupportTest()
const QIcon & getIcon(const String &name)
void setLoggingFilename(const String &string)
QAction * insertMenuEntry(Position parent_id, const String &name, const QObject *receiver=0, const char *slot=0, const String &description="", QKeySequence accel=QKeySequence(), UIOperationMode::OperationMode minimal_mode=UIOperationMode::MODE_ALL)
QAction * complement_selection_action_
const char * c_str() const BALL_NOEXCEPT
defines the property for the model: Stick
static UIOperationMode & instance()
virtual void restoreWindows()
Restore the positions the main window and of all DockWindow's from the INIFile assigned to this insta...
String find(const String &name)
virtual bool registerController(DatasetController *con)
void selectModel(int index)
LogStream & error(int n=0)
virtual void addToolBarEntries(QToolBar *tb)
virtual void keyPressEvent(QKeyEvent *e)
Catch key events.
void reset()
remove all loaded Molecules and Representations, reset Coloring options
virtual bool event(QEvent *e)
Interface to QT events, e.g. to communicate with other threads.
virtual void checkMenus()
static IconLoader & instance()
void selectColoringMethod(int index)
void quickSave()
Create a BALLView project file with the name quick.bvp in the users home dir.
void selectMode(int index)
void registerHandler(PluginHandler *h)
std::list< Composite * > control_selection_
virtual QMenu * initPopupMenu(int ID, UIOperationMode::OperationMode mode=UIOperationMode::MODE_ALL)
const char * bucky_64x64_xpm[]
QAction * save_project_action_
void setTransparency(int value)
void changeEvent(QEvent *evt)