32 #include <QHBoxLayout>
33 #include <QVBoxLayout>
34 #include <QPushButton>
35 #include <QInputDialog>
36 #include <QApplication>
37 #include <QProgressDialog>
39 #include <boost/bind/bind.hpp>
58 QPushButton* add_button =
new QPushButton(
"Add");
59 add_button->setShortcut(QKeySequence(QString(
"Ctrl+N")));
60 add_button->setToolTip(
"Add a new display, Ctrl+N");
74 QHBoxLayout* button_layout =
new QHBoxLayout;
75 button_layout->addWidget(add_button);
79 button_layout->setContentsMargins(2, 0, 2, 2);
81 QVBoxLayout* layout =
new QVBoxLayout;
82 layout->setContentsMargins(0, 0, 0, 2);
84 layout->addLayout(button_layout);
98 rename_action_->setShortcutContext(Qt::WidgetWithChildrenShortcut);
103 remove_action_->setShortcutContext(Qt::WidgetWithChildrenShortcut);
123 QString display_name;
129 QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
132 QApplication::restoreOverrideCursor();
135 if (dialog.exec() == QDialog::Accepted)
138 if (!topic.isEmpty() && !
datatype.isEmpty())
150 QList<Display*> duplicated_displays;
151 QProgressDialog progress_dlg(
"Duplicating displays...",
"Cancel", 0, displays_to_duplicate.size(),
154 progress_dlg.setWindowModality(Qt::WindowModal);
156 QApplication::processEvents();
159 for (
int i = 0; i < displays_to_duplicate.size(); i++)
162 QString lookup_name = displays_to_duplicate[i]->getClassId();
163 QString display_name = displays_to_duplicate[i]->getName();
167 displays_to_duplicate[i]->save(
config);
169 duplicated_displays.push_back(disp);
170 progress_dlg.setValue(i + 1);
171 QApplication::processEvents();
173 if (progress_dlg.wasCanceled())
177 if (!duplicated_displays.empty())
181 QItemSelection selection(first, last);
182 property_grid_->selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect);
192 for (
int i = 0; i < displays_to_delete.size(); i++)
196 displays_to_delete[i]->disconnect();
200 displays_to_delete[i]->deleteLater();
204 QItemSelection selection(cur.sibling(cur.row(), 0),
205 cur.sibling(cur.row(), cur.model()->columnCount() - 1));
206 property_grid_->selectionModel()->select(selection, QItemSelectionModel::ClearAndSelect);
215 int num_displays_selected = displays.size();
228 if (displays.empty())
232 Display* display_to_rename = displays[0];
234 QString old_name = display_to_rename->
getName();
236 QInputDialog::getText(
this,
"Rename Display",
"New Name?", QLineEdit::Normal, old_name);
238 if (new_name.isEmpty() || new_name == old_name)
243 display_to_rename->
setName(new_name);