Implemented basic time control toolbar for Qt4 front-end.

ver1_5_1
Chris Laurel 2008-01-15 20:24:58 +00:00
parent 4a917330f2
commit 79a21cfdd4
3 changed files with 41 additions and 25 deletions

View File

@ -273,8 +273,10 @@ QTAPP_SOURCES = \
celestia/qt/qtpreferencesdialog.cpp \
celestia/qt/qtcelestialbrowser.cpp \
celestia/qt/qtdeepskybrowser.cpp \
celestia/qt/qtsolarsystembrowser.cpp \
celestia/qt/qtselectionpopup.cpp \
celestia/qt/qtcolorswatchwidget.cpp
celestia/qt/qtcolorswatchwidget.cpp \
celestia/qt/qttimetoolbar.cpp
QTAPP_HEADERS = \
celestia/qt/qtappwin.h \
@ -282,8 +284,10 @@ QTAPP_HEADERS = \
celestia/qt/qtpreferencesdialog.h \
celestia/qt/qtcelestialbrowser.h \
celestia/qt/qtdeepskybrowser.h \
celestia/qt/qtsolarsystembrowser.h \
celestia/qt/qtselectionpopup.h \
celestia/qt/qtcolorswatchwidget.h
celestia/qt/qtcolorswatchwidget.h \
celestia/qt/qttimetoolbar.h
SOURCES = \
$$UTIL_SOURCES \

View File

@ -27,6 +27,7 @@
#include "qtcelestialbrowser.h"
#include "qtdeepskybrowser.h"
#include "qtselectionpopup.h"
#include "qttimetoolbar.h"
using namespace std;
@ -92,32 +93,36 @@ CelestiaAppWindow::CelestiaAppWindow(const QString& qConfigFileName,
QTabWidget* tabWidget = new QTabWidget(this);
tabWidget->setObjectName("celestia-tabbed-browser");
celestialBrowser = new CelestialBrowser(appCore, NULL);
celestialBrowser->setObjectName("celestia-browser");
toolsDock = new QDockWidget(tr("Celestial Browser"), this);
toolsDock->setObjectName("celestia-tools-dock");
toolsDock->setAllowedAreas(Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea);
#if 0
toolsDock->setWidget(celestialBrowser);
addDockWidget(Qt::LeftDockWidgetArea, toolsDock);
#else
// Create the various browser widgets
celestialBrowser = new CelestialBrowser(appCore, NULL);
celestialBrowser->setObjectName("celestia-browser");
QWidget* deepSkyBrowser = new DeepSkyBrowser(appCore, NULL);
deepSkyBrowser->setObjectName("deepsky-browser");
SolarSystemBrowser* solarSystemBrowser = new SolarSystemBrowser(appCore, NULL);
solarSystemBrowser->setObjectName("ssys-browser");
// Set up the browser tabs
tabWidget->addTab(solarSystemBrowser, tr("Solar System"));
tabWidget->addTab(celestialBrowser, tr("Stars"));
tabWidget->addTab(deepSkyBrowser, tr("Deep Sky Objects"));
toolsDock->setWidget(tabWidget);
addDockWidget(Qt::LeftDockWidgetArea, toolsDock);
#endif
TimeToolBar* timeToolBar = new TimeToolBar(appCore, tr("Time"));
timeToolBar->setFloatable(true);
timeToolBar->setMovable(true);
addToolBar(Qt::TopToolBarArea, timeToolBar);
viewMenu->addAction(toolsDock->toggleViewAction());
viewMenu->addAction(timeToolBar->toggleViewAction());
glWidget->setFocus();

View File

@ -22,50 +22,57 @@ TimeToolBar::TimeToolBar(CelestiaCore* _appCore,
QToolBar(title, parent),
appCore(_appCore)
{
#if 0
#if 1
// Text-only buttons
setToolButtonStyle(Qt::ToolButtonTextOnly);
QAction* reverseTimeAction = new QAction(QString("< >"), this);
reverseTimeAction->setToolTip(tr("Reverse time"));
QAction* slowTimeAction = new QAction(QString("<<|"), this);
slowTimeAction->setToolTip(tr("10x slower"));
QAction* halfTimeAction = new QAction(QString("<|"), this);
halfTimeAction->setToolTip(tr("2x slower"));
QAction* pauseAction = new QAction(QString("||"), this);
pauseAction->setToolTip(tr("Pause time"));
QAction* realTimeAction = new QAction(QString(">"), this);
realTimeAction->setToolTip(tr("Real time"));
QAction* doubleTimeAction = new QAction(QString(">>"), this);
doubleTimeAction->setToolTip(tr("2x faster"));
QAction* fastTimeAction = new QAction(QString(">>>"), this);
#endif
fastTimeAction->setToolTip(tr("10x faster"));
#else
QAction* reverseTimeAction = new QAction(QIcon("icons/qt/media-eject.png"),
tr("Reverse time"), this);
QAction* slowTimeAction = new QAction(QIcon("icons/qt/media-skip-backward.png"),
tr("10x slower"), this);
QAction* halfTimeAction = new QAction(QIcon("icons/qt/media-seek-backward.png"),
tr("2x slower"), this);
QAction* pauseAction = new QAction(QIcon("icons/qt/media-playback-pause.png"),
tr("Pause time"), this);
QAction* realTimeAction = new QAction(QIcon("icons/qt/media-playback-start.png"),
tr("Real time"), this);
QAction* doubleTimeAction = new QAction(QIcon("icons/qt/media-seek-forward.png"),
tr("2x faster"), this);
QAction* fastTimeAction = new QAction(QIcon("icons/qt/media-skip-forward.png"),
tr("10x faster"), this);
#endif
connect(reverseTimeAction, SIGNAL(triggered()), this, SLOT(slotReverseTime()));
addAction(reverseTimeAction);
QAction* slowTimeAction = new QAction(QIcon("icons/qt/media-skip-backward.png"),
tr("10x slower"), this);
connect(slowTimeAction, SIGNAL(triggered()), this, SLOT(slotSlower()));
addAction(slowTimeAction);
QAction* halfTimeAction = new QAction(QIcon("icons/qt/media-seek-backward.png"),
tr("2x slower"), this);
connect(halfTimeAction, SIGNAL(triggered()), this, SLOT(slotHalfTime()));
addAction(halfTimeAction);
QAction* pauseAction = new QAction(QIcon("icons/qt/media-playback-pause.png"),
tr("Pause time"), this);
connect(pauseAction, SIGNAL(triggered()), this, SLOT(slotPauseTime()));
addAction(pauseAction);
QAction* realTimeAction = new QAction(QIcon("icons/qt/media-playback-start.png"),
tr("Real time"), this);
connect(realTimeAction, SIGNAL(triggered()), this, SLOT(slotRealTime()));
addAction(realTimeAction);
QAction* doubleTimeAction = new QAction(QIcon("icons/qt/media-seek-forward.png"),
tr("2x faster"), this);
connect(doubleTimeAction, SIGNAL(triggered()), this, SLOT(slotDoubleTime()));
addAction(doubleTimeAction);
QAction* fastTimeAction = new QAction(QIcon("icons/qt/media-skip-forward.png"),
tr("10x faster"), this);
connect(fastTimeAction, SIGNAL(triggered()), this, SLOT(slotFaster()));
addAction(fastTimeAction);
}