本文整理汇总了C++中StelGui::getButtonBar方法的典型用法代码示例。如果您正苦于以下问题:C++ StelGui::getButtonBar方法的具体用法?C++ StelGui::getButtonBar怎么用?C++ StelGui::getButtonBar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StelGui
的用法示例。
在下文中一共展示了StelGui::getButtonBar方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StelButton
void Scenery3d::createToolbarButtons() const
{
// Add 3 toolbar buttons (copy/paste widely from AngleMeasure): activate, settings, and viewpoints.
try
{
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
if (gui!=Q_NULLPTR)
{
StelButton* toolbarEnableButton = new StelButton(Q_NULLPTR,
QPixmap(":/Scenery3d/bt_scenery3d_on.png"),
QPixmap(":/Scenery3d/bt_scenery3d_off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_Scenery3d");
StelButton* toolbarSettingsButton = new StelButton(Q_NULLPTR,
QPixmap(":/Scenery3d/bt_scenery3d_settings_on.png"),
QPixmap(":/Scenery3d/bt_scenery3d_settings_off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_Scenery3d_dialog");
StelButton* toolbarStoredViewButton = new StelButton(Q_NULLPTR,
QPixmap(":/Scenery3d/bt_scenery3d_eyepoint_on.png"),
QPixmap(":/Scenery3d/bt_scenery3d_eyepoint_off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_Scenery3d_storedViewDialog");
gui->getButtonBar()->addButton(toolbarEnableButton, "065-pluginsGroup");
gui->getButtonBar()->addButton(toolbarSettingsButton, "065-pluginsGroup");
gui->getButtonBar()->addButton(toolbarStoredViewButton, "065-pluginsGroup");
}
}
catch (std::runtime_error& e)
{
qCWarning(scenery3d) << "WARNING: unable to create toolbar buttons for Scenery3d plugin: " << e.what();
}
}
示例2: setShowSearchButton
void MeteorShowersMgr::setShowSearchButton(const bool& show)
{
try
{
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
if (!gui)
{
return;
}
if (show)
{
StelButton* searchMS = new StelButton(NULL,
QPixmap(":/MeteorShowers/btMS-search-on.png"),
QPixmap(":/MeteorShowers/btMS-search-off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_MeteorShowers_search_dialog");
gui->getButtonBar()->addButton(searchMS, "065-pluginsGroup");
}
else
{
gui->getButtonBar()->hideButton("actionShow_MeteorShowers_search_dialog");
}
}
catch (std::runtime_error& e)
{
qWarning() << "MeteorShowersMgr : unable to create toolbar buttons for MeteorShowers plugin!"
<< e.what();
}
m_showSearchButton = show;
m_conf->setValue(MS_CONFIG_PREFIX + "/show_search_button", show);
}
示例3: initializeActions
void LogBook::initializeActions()
{
QString group = "LogBook";
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
Q_ASSERT(gui);
gui->addGuiActions("actionShow_LogBook", N_("Open LogBook"), "Ctrl+L", "Plugin Key Bindings", true);
gui->getGuiActions("actionShow_LogBook")->setChecked(flagShowLogBook);
gui->addGuiActions("actionShow_LogBookConfigDialog", N_("Show data config dialog"), "ALT+L", group, true);
gui->addGuiActions("actionShow_TargetsDialog", N_("Show Targets config dialog"), "ALT+T", group, true);
connect(gui->getGuiActions("actionShow_LogBook"), SIGNAL(toggled(bool)), this, SLOT(enableLogBook(bool)));
connect(gui->getGuiActions("actionShow_LogBookConfigDialog"), SIGNAL(toggled(bool)), this, SLOT(setConfigDialogVisible(bool)));
connect(gui->getGuiActions("actionShow_TargetsDialog"), SIGNAL(toggled(bool)), this, SLOT(setTargetsDialogVisible(bool)));
// Make a toolbar button
try {
pxmapGlow = new QPixmap(":/graphicGui/glow32x32.png");
pxmapOnIcon = new QPixmap(":/logbook/bt_Logbook_on.png");
pxmapOffIcon = new QPixmap(":/logbook/bt_Logbook_off.png");
toolbarButton = new StelButton(NULL,
*pxmapOffIcon,
*pxmapOnIcon,
*pxmapGlow,
gui->getGuiActions("actionShow_LogBook"));
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
} catch (std::runtime_error& e) {
qWarning() << "WARNING: unable create toolbar button for LogBook plugin: "<< e.what();
}
}
示例4: init
void CompassMarks::init()
{
// Because the plug-in has no configuration GUI, users rely on what's
// written in the configuration file to know what can be configured.
Q_ASSERT(conf);
if (!conf->childGroups().contains("CompassMarks"))
restoreDefaultConfiguration();
loadConfiguration();
try
{
addAction("actionShow_Compass_Marks", N_("Compass Marks"), N_("Compass marks"), "marksVisible");
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
if (gui != Q_NULLPTR)
{
toolbarButton = new StelButton(Q_NULLPTR,
QPixmap(":/compassMarks/bt_compass_on.png"),
QPixmap(":/compassMarks/bt_compass_off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_Compass_Marks");
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
}
connect(GETSTELMODULE(LandscapeMgr), SIGNAL(cardinalsPointsDisplayedChanged(bool)), this, SLOT(cardinalPointsChanged(bool)));
cardinalPointsState = false;
setCompassMarks(displayedAtStartup);
}
catch (std::runtime_error& e)
{
qWarning() << "WARNING: unable create toolbar button for CompassMarks plugin: " << e.what();
}
}
示例5: setFlagShowPulsarsButton
// Define whether the button toggling pulsars should be visible
void Pulsars::setFlagShowPulsarsButton(bool b)
{
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
if (gui!=Q_NULLPTR)
{
if (b==true) {
if (toolbarButton==Q_NULLPTR) {
// Create the pulsars button
toolbarButton = new StelButton(Q_NULLPTR, *OnIcon, *OffIcon, *GlowIcon, "actionShow_Pulsars");
}
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
} else {
gui->getButtonBar()->hideButton("actionShow_Pulsars");
}
}
flagShowPulsarsButton = b;
}
示例6: init
void NavStars::init()
{
if (!conf->childGroups().contains("NavigationalStars"))
{
qDebug() << "[NavStars] no coordinates section exists in main config file - creating with defaults";
restoreDefaultConfiguration();
}
// populate settings from main config file.
loadConfiguration();
// populate list of navigational stars
populateNavigationalStarsSet();
// Marker texture - using the same texture as the planet hints.
QString path = StelFileMgr::findFile("textures/planet-indicator.png");
markerTexture = StelApp::getInstance().getTextureManager().createTexture(path);
// key bindings and other actions
addAction("actionShow_NavStars",
N_("Navigational Stars"),
N_("Mark the navigational stars"),
"navStarsVisible", "");
// Toolbar button
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
if (gui!=NULL)
{
if (toolbarButton == NULL)
{
// Create the nav. stars button
toolbarButton = new StelButton(NULL,
QPixmap(":/NavStars/btNavStars-on.png"),
QPixmap(":/NavStars/btNavStars-off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_NavStars");
}
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
}
// Sync global settings for stars labels
connect(smgr, SIGNAL(starLabelsDisplayedChanged(bool)),
this, SLOT(starNamesChanged(bool)));
starNamesState = false;
}
示例7: init
void AngleMeasure::init()
{
if (!conf->childGroups().contains("AngleMeasure"))
restoreDefaultSettings();
loadSettings();
startPoint.set(0.,0.,0.);
endPoint.set(0.,0.,0.);
perp1StartPoint.set(0.,0.,0.);
perp1EndPoint.set(0.,0.,0.);
perp2StartPoint.set(0.,0.,0.);
perp2EndPoint.set(0.,0.,0.);
StelApp& app = StelApp::getInstance();
// Create action for enable/disable & hook up signals
addAction("actionShow_Angle_Measure", N_("Angle Measure"), N_("Angle measure"), "enabled", "Ctrl+A");
// Initialize the message strings and make sure they are translated when
// the language changes.
updateMessageText();
connect(&app, SIGNAL(languageChanged()), this, SLOT(updateMessageText()));
// Add a toolbar button
try
{
StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
if (gui!=NULL)
{
toolbarButton = new StelButton(NULL,
QPixmap(":/angleMeasure/bt_anglemeasure_on.png"),
QPixmap(":/angleMeasure/bt_anglemeasure_off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_Angle_Measure");
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
}
}
catch (std::runtime_error& e)
{
qWarning() << "WARNING: unable create toolbar button for AngleMeasure plugin: " << e.what();
}
}
示例8: init
////////////////////////////////////////////////////////////////////////////////
// Methods inherited from the StelModule class
// init(), update(), draw(), getCallOrder()
void TelescopeControl::init()
{
//TODO: I think I've overdone the try/catch...
try
{
//Main configuration
loadConfiguration();
//Make sure that such a section is created, if it doesn't exist
saveConfiguration();
//Make sure that the module directory exists
QString moduleDirectoryPath = StelFileMgr::getUserDir() + "/modules/TelescopeControl";
if(!StelFileMgr::exists(moduleDirectoryPath))
StelFileMgr::mkDir(moduleDirectoryPath);
//Load the device models
loadDeviceModels();
if(deviceModels.isEmpty())
{
qWarning() << "[TelescopeControl] No device model descriptions have been loaded. Stellarium will not be able to control a telescope on its own, but it is still possible to do it through an external application or to connect to a remote host.";
}
//Unload Stellarium's internal telescope control module
//(not necessary since revision 6308; remains as an example)
//StelApp::getInstance().getModuleMgr().unloadModule("TelescopeMgr", false);
/*If the alsoDelete parameter is set to true, Stellarium crashes with a
segmentation fault when an object is selected. TODO: Find out why.
unloadModule() didn't work prior to revision 5058: the module unloaded
normally, but Stellarium crashed later with a segmentation fault,
because LandscapeMgr::getCallOrder() depended on the module's
existence to return a value.*/
//Load and start all telescope clients
loadTelescopes();
//Load OpenGL textures
reticleTexture = StelApp::getInstance().getTextureManager().createTexture(":/telescopeControl/telescope_reticle.png");
selectionTexture = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png");
QSignalMapper* slewObj = new QSignalMapper(this);
QSignalMapper* slewDir = new QSignalMapper(this);
//Create telescope key bindings
/* StelAction-s with these key bindings existed in Stellarium prior to
revision 6311. Any future backports should account for that. */
QString section = N_("Telescope Control");
for (int i = MIN_SLOT_NUMBER; i <= MAX_SLOT_NUMBER; i++)
{
// "Slew to object" commands
QString name = moveToSelectedActionId.arg(i);
QString shortcut = QString("Ctrl+%1").arg(i);
QString text;
text = q_("Move telescope #%1 to selected object").arg(i);
StelAction* actionSlewObj = addAction(name, section, text, slewObj, "map()", shortcut);
slewObj->setMapping(actionSlewObj, i);
// "Slew to the center of the screen" commands
name = moveToCenterActionId.arg(i);
shortcut = QString("Alt+%1").arg(i);
text = q_("Move telescope #%1 to the point currently in the center of the screen").arg(i);
StelAction* actionSlewDir = addAction(name, section, text, slewDir, "map()", shortcut);
slewDir->setMapping(actionSlewDir, i);
}
connect(slewObj,SIGNAL(mapped(int)),this,SLOT(slewTelescopeToSelectedObject(int)));
connect(slewDir,SIGNAL(mapped(int)),this,SLOT(slewTelescopeToViewDirection(int)));
connect(&StelApp::getInstance(), SIGNAL(languageChanged()),
this, SLOT(translateActionDescriptions()));
//Create and initialize dialog windows
telescopeDialog = new TelescopeDialog();
slewDialog = new SlewDialog();
addAction("actionShow_Slew_Window", N_("Telescope Control"), N_("Move a telescope to a given set of coordinates"), slewDialog, "visible", "Ctrl+0");
//Create toolbar button
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
if (gui!=NULL)
{
toolbarButton = new StelButton(NULL,
QPixmap(":/telescopeControl/button_Slew_Dialog_on.png"),
QPixmap(":/telescopeControl/button_Slew_Dialog_off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_Slew_Window");
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
}
}
catch (std::runtime_error &e)
{
qWarning() << "[TelescopeControl] init() error: " << e.what();
return;
}
GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
}
示例9: init
void Satellites::init()
{
QSettings* conf = StelApp::getInstance().getSettings();
try
{
// TODO: Compatibility with installation-dir modules? --BM
// It seems that the original code couldn't handle them either.
QString dirPath = StelFileMgr::getUserDir() + "/modules/Satellites";
// TODO: Ideally, this should return a QDir object
StelFileMgr::makeSureDirExistsAndIsWritable(dirPath);
dataDir.setPath(dirPath);
// If no settings in the main config file, create with defaults
if (!conf->childGroups().contains("Satellites"))
{
//qDebug() << "Stellites: created section in config file.";
restoreDefaultSettings();
}
// populate settings from main config file.
loadSettings();
// absolute file name for inner catalog of the satellites
catalogPath = dataDir.absoluteFilePath("satellites.json");
// absolute file name for qs.mag file
qsMagFilePath = dataDir.absoluteFilePath("qs.mag");
// Load and find resources used in the plugin
texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur5.png");
Satellite::hintTexture = StelApp::getInstance().getTextureManager().createTexture(":/satellites/hint.png");
// key bindings and other actions
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
QString satGroup = N_("Satellites");
addAction("actionShow_Satellite_Hints", satGroup, N_("Satellite hints"), "hintsVisible", "Ctrl+Z");
addAction("actionShow_Satellite_Labels", satGroup, N_("Satellite labels"), "labelsVisible", "Shift+Z");
addAction("actionShow_Satellite_ConfigDialog_Global", satGroup, N_("Satellites configuration window"), configDialog, "visible", "Alt+Z");
// Gui toolbar button
toolbarButton = new StelButton(NULL,
QPixmap(":/satellites/bt_satellites_on.png"),
QPixmap(":/satellites/bt_satellites_off.png"),
QPixmap(":/graphicGui/glow32x32.png"),
"actionShow_Satellite_Hints");
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
}
catch (std::runtime_error &e)
{
qWarning() << "Satellites::init error: " << e.what();
return;
}
// A timer for hiding alert messages
messageTimer = new QTimer(this);
messageTimer->setSingleShot(true); // recurring check for update
messageTimer->setInterval(9000); // 6 seconds should be enough time
messageTimer->stop();
connect(messageTimer, SIGNAL(timeout()), this, SLOT(hideMessages()));
// If the json file does not already exist, create it from the resource in the QT resource
if(QFileInfo(catalogPath).exists())
{
if (!checkJsonFileFormat() || readCatalogVersion() != SATELLITES_PLUGIN_VERSION)
{
displayMessage(q_("The old satellites.json file is no longer compatible - using default file"), "#bb0000");
restoreDefaultCatalog();
}
}
else
{
qDebug() << "Satellites::init satellites.json does not exist - copying default file to " << QDir::toNativeSeparators(catalogPath);
restoreDefaultCatalog();
}
if(!QFileInfo(qsMagFilePath).exists())
{
restoreDefaultQSMagFile();
}
qDebug() << "Satellites: loading catalog file:" << QDir::toNativeSeparators(catalogPath);
// create satellites according to content os satellites.json file
loadCatalog();
// Set up download manager and the update schedule
downloadMgr = new QNetworkAccessManager(this);
connect(downloadMgr, SIGNAL(finished(QNetworkReply*)),
this, SLOT(saveDownloadedUpdate(QNetworkReply*)));
updateState = CompleteNoUpdates;
updateTimer = new QTimer(this);
updateTimer->setSingleShot(false); // recurring check for update
updateTimer->setInterval(13000); // check once every 13 seconds to see if it is time for an update
connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate()));
updateTimer->start();
earth = GETSTELMODULE(SolarSystem)->getEarth();
GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
// Handle changes to the observer location:
//.........这里部分代码省略.........
示例10: init
/*
Init our module
*/
void Exoplanets::init()
{
try
{
StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir()+"/modules/Exoplanets");
// If no settings in the main config file, create with defaults
if (!conf->childGroups().contains("Exoplanets"))
{
qDebug() << "Exoplanets::init no Exoplanets section exists in main config file - creating with defaults";
restoreDefaultConfigIni();
}
// populate settings from main config file.
readSettingsFromConfig();
jsonCatalogPath = StelFileMgr::findFile("modules/Exoplanets", (StelFileMgr::Flags)(StelFileMgr::Directory|StelFileMgr::Writable)) + "/exoplanets.json";
// key bindings and other actions
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png");
OnIcon = new QPixmap(":/Exoplanets/btExoplanets-on.png");
OffIcon = new QPixmap(":/Exoplanets/btExoplanets-off.png");
gui->getGuiAction("actionShow_Exoplanets")->setChecked(flagShowExoplanets);
toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, gui->getGuiAction("actionShow_Exoplanets"));
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
connect(gui->getGuiAction("actionShow_Exoplanets_ConfigDialog"), SIGNAL(toggled(bool)), exoplanetsConfigDialog, SLOT(setVisible(bool)));
connect(exoplanetsConfigDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Exoplanets_ConfigDialog"), SLOT(setChecked(bool)));
connect(gui->getGuiAction("actionShow_Exoplanets"), SIGNAL(toggled(bool)), this, SLOT(setFlagShowExoplanets(bool)));
}
catch (std::runtime_error &e)
{
qWarning() << "Exoplanets::init error: " << e.what();
return;
}
// A timer for hiding alert messages
messageTimer = new QTimer(this);
messageTimer->setSingleShot(true); // recurring check for update
messageTimer->setInterval(9000); // 6 seconds should be enough time
messageTimer->stop();
connect(messageTimer, SIGNAL(timeout()), this, SLOT(messageTimeout()));
// If the json file does not already exist, create it from the resource in the Qt resource
if(QFileInfo(jsonCatalogPath).exists())
{
if (getJsonFileVersion() < CATALOG_FORMAT_VERSION)
{
restoreDefaultJsonFile();
}
}
else
{
qDebug() << "Exoplanets::init catalog.json does not exist - copying default file to " << jsonCatalogPath;
restoreDefaultJsonFile();
}
qDebug() << "Exoplanets::init using catalog.json file: " << jsonCatalogPath;
readJsonFile();
// Set up download manager and the update schedule
downloadMgr = new QNetworkAccessManager(this);
connect(downloadMgr, SIGNAL(finished(QNetworkReply*)), this, SLOT(updateDownloadComplete(QNetworkReply*)));
updateState = CompleteNoUpdates;
updateTimer = new QTimer(this);
updateTimer->setSingleShot(false); // recurring check for update
updateTimer->setInterval(13000); // check once every 13 seconds to see if it is time for an update
connect(updateTimer, SIGNAL(timeout()), this, SLOT(checkForUpdate()));
updateTimer->start();
GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
}