28 #ifdef BALL_PYTHON_SUPPORT
35 #include <BALL/COMMON/version.h>
37 #include <QtGui/QKeyEvent>
38 #include <QtGui/QTreeWidget>
45 #include "ui_aboutDialog.h"
55 using namespace BALL::VIEW;
57 Mainframe::Mainframe(
QWidget* parent,
const char* name)
61 #ifdef BALL_VIEW_DEBUG
62 Log.
error() <<
"new Mainframe " <<
this << std::endl;
68 setWindowTitle(tr(
"BALLView"));
77 #ifdef BALL_PYTHON_SUPPORT
92 String description =
"Shortcut|Display|Toggle_Fullscreen";
95 QKeySequence(
"Alt+X"));
110 addDockWidget(Qt::LeftDockWidgetArea,
new GeometricControl(
this, ((
String)tr(
"Representations")).c_str()));
111 addDockWidget(Qt::TopDockWidgetArea,
new DatasetControl(
this, ((
String)tr(
"Datasets")).c_str()));
121 DatasetControl::getInstance(0)->hide();
134 addDockWidget(Qt::BottomDockWidgetArea, BALL_docu);
144 Log.
error() <<
"Please build the BALL documentation!" << std::endl;
147 addDockWidget(Qt::BottomDockWidgetArea,
new HelpViewer(
this,
"BALLView Docu"));
150 addDockWidget(Qt::BottomDockWidgetArea,
new LogView(
this, ((
String)tr(
"Logs")).c_str()));
151 addDockWidget(Qt::BottomDockWidgetArea,
new FileObserver(
this, ((
String)tr(
"FileObserver")).c_str()));
156 setAcceptDrops(
true);
168 #ifdef BALL_PYTHON_SUPPORT
170 addDockWidget(Qt::BottomDockWidgetArea,
new PyWidget(
this, ((
String)tr(
"Python Interpreter")).c_str()));
177 description =
"Shortcut|File|Open|Project";
181 description =
"Shortcut|File|Save_Project";
188 description =
"Shortcut|Help|About";
190 setMenuHint(action, (
String)tr(
"Show informations on this version of BALLView"));
192 description =
"Shortcut|Help|How_to_cite";
197 description =
"Shortcut|MolecularMechanics|Abort_Calculation";
200 QKeySequence(
"Alt+C"));
208 description =
"Shortcut|Edit|Invert_Selection";
212 description =
"Shortcut|Edit|Clear_Selection";
217 qApp->installEventFilter(
this);
229 if (event->type() != QEvent::KeyPress)
return false;
231 QKeyEvent* e =
dynamic_cast<QKeyEvent*
>(
event);
233 if (e->key() == Qt::Key_Escape &&
234 HelpViewer::getInstance(
"BALLView Docu")->isWhatsThisEnabled())
236 HelpViewer::getInstance(
"BALLView Docu")->exitWhatsThisMode();
239 QPoint point = QCursor::pos();
240 QWidget* widget = qApp->widgetAt(point);
242 qApp->focusWidget() !=
scene_)
248 if (e->key() == Qt::Key_Delete &&
249 RTTI::isKindOf<QTreeWidget>(*sender))
255 if (e->key() == Qt::Key_Enter)
264 MolecularStructure::getInstance(0)->centerCamera();
269 if (e->key() == Qt::Key_Alt ||
270 e->key() == Qt::Key_Control)
276 #ifdef BALL_PYTHON_SUPPORT
277 PyWidget::getInstance(0)->reactTo(*e);
303 HelpViewer::getInstance(
"BALLView Docu")->showHelp(
"tips.html", (
String)tr(
"cite"));
316 QToolBar* tb =
new QToolBar(
"Main Toolbar",
this);
317 tb->setObjectName(
"Main Toolbar");
318 tb->setIconSize(QSize(22,22));
319 addToolBar(Qt::TopToolBarArea, tb);
325 MolecularFileDialog::getInstance(0)->addToolBarEntries(tb);
326 DownloadPDBFile::getInstance(0)->addToolBarEntries(tb);
327 DownloadElectronDensity::getInstance(0)->addToolBarEntries(tb);
328 PubChemDialog::getInstance(0)->addToolBarEntries(tb);
329 UndoManagerDialog::getInstance(0)->addToolBarEntries(tb);
337 HelpViewer::getInstance(
"BALLView Docu")->registerForHelpSystem(
qload_action_,
"tips.html#quickload");
343 HelpViewer::getInstance(
"BALLView Docu")->registerForHelpSystem(
qsave_action_,
"tips.html#quickload");
347 DisplayProperties::getInstance(0)->addToolBarEntries(tb);
348 MolecularStructure::getInstance(0)->addToolBarEntries(tb);
352 HelpViewer::getInstance(
"BALLView Docu")->addToolBarEntries(tb);
363 Ui_AboutDialog
about;
365 QString version = QString(tr(
"QT ")) + qVersion();
366 #ifdef BALL_QT_HAS_THREADS
369 about.qt_version_label->setText(version);
370 QFont font = about.BALLView_version_label->font();
371 about.BALLView_version_label->setText(QString(
"BALLView ") + BALL_RELEASE_STRING);
372 font.setPixelSize(18);
373 about.BALLView_version_label->setFont(font);
374 about.BALL_version_label->setText(__DATE__);
378 String logo_path = p.
find(
"graphics/logo.png");
381 about.BALLView_logo_label->setPixmap(QPixmap(logo_path.c_str()));
388 if(evt->type() == QEvent::WindowStateChange) {