1 #include <ui_ToolbarsWidgetForm.h> 6 #include "../../../common/STLUtils.h" 7 #include "../ApplicationController.h" 11 #include <QInputDialog> 12 #include <QMessageBox> 18 std::vector<QToolBar*>::iterator it;
20 for(it=bars.begin(); it != bars.end(); ++it)
23 cmb->addItem(tb->objectName(), QVariant::fromValue<QObject*>(tb));
24 acts.push_back(tb->actions());
33 view->setModel(model);
38 void UpdateActions(QList<QAction*>& acts, QAction* act,
const bool& toAdd)
48 std::set<QToolBar*>::const_iterator it;
50 for(it = bars.begin(); it != bars.end(); ++it)
64 m_ui(new
Ui::ToolbarsWidgetForm)
69 m_ui->m_addToolButton->setIcon(QIcon::fromTheme(
"list-add"));
70 m_ui->m_removeToolButton->setIcon(QIcon::fromTheme(
"list-remove"));
71 m_ui->m_actionsListViewWidget->setSelectionMode(QAbstractItemView::SingleSelection);
78 m_resumeText = tr(
"Add, remove or modify system tool bars.");
89 for (
int i=0; i<
m_ui->m_toolbarsComboBox->count(); i++)
91 QToolBar* bar = (QToolBar*)
m_ui->m_toolbarsComboBox->itemData(i, Qt::UserRole).value<
QObject*>();
99 std::set<QToolBar*>::iterator it;
127 m_ui->m_toolbarsComboBox->clear();
137 ns =
"dpi.inpe.br.apf";
138 helpFile =
"apf/settings/toolbar/ToolbarConfig.html";
147 connect(
m_ui->m_actionsListViewWidget->model(), SIGNAL(updateAction(QAction*,
const bool&)), SLOT(
updateActions(QAction*,
const bool&)));
162 QString text = QInputDialog::getText(
this, tr(
"Creating tool bar"), tr(
"Tool bar name:"),
QLineEdit::Normal, tr(
"Name of the new toolbar"), &ok);
169 QMessageBox::warning(
this, tr(
"Creating tool bar"), tr(
"Empty tool bar name not allowed!"));
173 QToolBar* bar =
new QToolBar;
174 bar->setObjectName(text);
178 int count =
m_ui->m_toolbarsComboBox->count();
180 m_ui->m_toolbarsComboBox->addItem(bar->objectName(), QVariant::fromValue<QObject*>(bar));
182 QList<QAction*> acts;
187 m_ui->m_toolbarsComboBox->setCurrentIndex(count);
192 QString msg = tr(
"Did you really want to remove tool bar?");
194 if(QMessageBox::question(
this, tr(
"Tool bars customization"), msg, QMessageBox::No, QMessageBox::Yes) == QMessageBox::No)
197 int idx =
m_ui->m_toolbarsComboBox->currentIndex();
199 QToolBar* bar = (QToolBar*)
m_ui->m_toolbarsComboBox->itemData(idx, Qt::UserRole).value<
QObject*>();
203 m_ui->m_toolbarsComboBox->removeItem(idx);
215 int idx =
m_ui->m_toolbarsComboBox->currentIndex();
TEQTAFEXPORT void RemoveToolBarFromSettings(QToolBar *bar)
Removes a tool bar from the settings.
The base API for TerraLib applications.
QMenuBar * getMenuBar(const QString &id) const
Returns a menu bar registered with key id.
TEQTAFEXPORT void UpdateToolBarsInTheSettings(te::qt::af::ApplicationController *appController)
Update plugins file.
TEQTAFEXPORT void AddToolBarToSettings(QToolBar *bar)
Update settings with a new tool bar.
void removeToolBar(const QString &id)
Removes the toolbar identified by id.
void addToolBar(const QString &id, QToolBar *bar)
Register the toolbar in the list of the known toolbars and dispatch an event.
std::vector< QToolBar * > getToolBars() const
Return the list of registered toolbars.
void FreeContents(boost::unordered_map< K, V * > &m)
This function can be applied to a map of pointers. It will delete each pointer in the map...