Changeset View
Changeset View
Standalone View
Standalone View
kcontrol/kamera.cpp
Show First 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 94 | { | |||
---|---|---|---|---|---|
105 | m_toolbar->setMovable(false); | 105 | m_toolbar->setMovable(false); | ||
106 | 106 | | |||
107 | // create list of devices - this is the large white box | 107 | // create list of devices - this is the large white box | ||
108 | m_deviceSel = new QListView(this); | 108 | m_deviceSel = new QListView(this); | ||
109 | topLayout->addWidget(m_deviceSel); | 109 | topLayout->addWidget(m_deviceSel); | ||
110 | 110 | | |||
111 | m_deviceSel->setModel(m_deviceModel); | 111 | m_deviceSel->setModel(m_deviceModel); | ||
112 | 112 | | |||
113 | connect(m_deviceSel, SIGNAL(customContextMenuRequested(QPoint)), | 113 | connect(m_deviceSel, &QListView::customContextMenuRequested, | ||
114 | SLOT(slot_deviceMenu(QPoint))); | 114 | this, &KKameraConfig::slot_deviceMenu); | ||
115 | connect(m_deviceSel, SIGNAL(doubleClicked(QModelIndex)), | 115 | connect(m_deviceSel, &QListView::doubleClicked, | ||
116 | SLOT(slot_configureCamera())); | 116 | this, &KKameraConfig::slot_configureCamera); | ||
117 | connect(m_deviceSel, SIGNAL(activated(QModelIndex)), | 117 | connect(m_deviceSel, &QListView::activated, | ||
118 | SLOT(slot_deviceSelected(QModelIndex))); | 118 | this, &KKameraConfig::slot_deviceSelected); | ||
119 | connect(m_deviceSel, SIGNAL(clicked(QModelIndex)), | 119 | connect(m_deviceSel, &QListView::clicked, | ||
120 | SLOT(slot_deviceSelected(QModelIndex))); | 120 | this, &KKameraConfig::slot_deviceSelected); | ||
121 | 121 | | |||
122 | m_deviceSel->setViewMode(QListView::IconMode); | 122 | m_deviceSel->setViewMode(QListView::IconMode); | ||
123 | m_deviceSel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | 123 | m_deviceSel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
124 | m_deviceSel->setContextMenuPolicy(Qt::CustomContextMenu); | 124 | m_deviceSel->setContextMenuPolicy(Qt::CustomContextMenu); | ||
125 | 125 | | |||
126 | // create actions, add to the toolbar | 126 | // create actions, add to the toolbar | ||
127 | QAction *act; | 127 | QAction *act; | ||
128 | act = m_actions->addAction("camera_add"); | 128 | act = m_actions->addAction("camera_add"); | ||
129 | act->setIcon(QIcon::fromTheme("camera-photo")); | 129 | act->setIcon(QIcon::fromTheme("camera-photo")); | ||
130 | act->setText(i18n("Add")); | 130 | act->setText(i18n("Add")); | ||
131 | connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_addCamera())); | 131 | connect(act, &QAction::triggered, this, &KKameraConfig::slot_addCamera); | ||
mlaurent: Remove extra tab. Same for other lines | |||||
132 | act->setWhatsThis(i18n("Click this button to add a new camera.")); | 132 | act->setWhatsThis(i18n("Click this button to add a new camera.")); | ||
133 | m_toolbar->addAction(act); | 133 | m_toolbar->addAction(act); | ||
134 | m_toolbar->addSeparator(); | 134 | m_toolbar->addSeparator(); | ||
135 | 135 | | |||
136 | act = m_actions->addAction("camera_test"); | 136 | act = m_actions->addAction("camera_test"); | ||
137 | act->setIcon(QIcon::fromTheme("dialog-ok")); | 137 | act->setIcon(QIcon::fromTheme("dialog-ok")); | ||
138 | act->setText(i18n("Test")); | 138 | act->setText(i18n("Test")); | ||
139 | connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_testCamera())); | 139 | connect(act, &QAction::triggered, this, &KKameraConfig::slot_testCamera); | ||
140 | act->setWhatsThis(i18n("Click this button to test the connection to the selected camera.")); | 140 | act->setWhatsThis(i18n("Click this button to test the connection to the selected camera.")); | ||
141 | m_toolbar->addAction(act); | 141 | m_toolbar->addAction(act); | ||
142 | 142 | | |||
143 | act = m_actions->addAction("camera_remove"); | 143 | act = m_actions->addAction("camera_remove"); | ||
144 | act->setIcon(QIcon::fromTheme("user-trash")); | 144 | act->setIcon(QIcon::fromTheme("user-trash")); | ||
145 | act->setText(i18n("Remove")); | 145 | act->setText(i18n("Remove")); | ||
146 | connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_removeCamera())); | 146 | connect(act, &QAction::triggered, this, &KKameraConfig::slot_removeCamera); | ||
147 | act->setWhatsThis(i18n("Click this button to remove the selected camera from the list.")); | 147 | act->setWhatsThis(i18n("Click this button to remove the selected camera from the list.")); | ||
148 | m_toolbar->addAction(act); | 148 | m_toolbar->addAction(act); | ||
149 | 149 | | |||
150 | act = m_actions->addAction("camera_configure"); | 150 | act = m_actions->addAction("camera_configure"); | ||
151 | act->setIcon(QIcon::fromTheme("configure")); | 151 | act->setIcon(QIcon::fromTheme("configure")); | ||
152 | act->setText(i18n("Configure...")); | 152 | act->setText(i18n("Configure...")); | ||
153 | connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_configureCamera())); | 153 | connect(act, &QAction::triggered, this, &KKameraConfig::slot_configureCamera); | ||
154 | act->setWhatsThis(i18n("Click this button to change the configuration of the selected camera.<br><br>The availability of this feature and the contents of the Configuration dialog depend on the camera model.")); | 154 | act->setWhatsThis(i18n("Click this button to change the configuration of the selected camera.<br><br>The availability of this feature and the contents of the Configuration dialog depend on the camera model.")); | ||
155 | m_toolbar->addAction(act); | 155 | m_toolbar->addAction(act); | ||
156 | 156 | | |||
157 | act = m_actions->addAction("camera_summary"); | 157 | act = m_actions->addAction("camera_summary"); | ||
158 | act->setIcon(QIcon::fromTheme("hwinfo")); | 158 | act->setIcon(QIcon::fromTheme("hwinfo")); | ||
159 | act->setText(i18n("Information")); | 159 | act->setText(i18n("Information")); | ||
160 | connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_cameraSummary())); | 160 | connect(act, &QAction::triggered, this, &KKameraConfig::slot_cameraSummary); | ||
161 | act->setWhatsThis(i18n("Click this button to view a summary of the current status of the selected camera.<br><br>The availability of this feature and the contents of the Information dialog depend on the camera model.")); | 161 | act->setWhatsThis(i18n("Click this button to view a summary of the current status of the selected camera.<br><br>The availability of this feature and the contents of the Information dialog depend on the camera model.")); | ||
162 | m_toolbar->addAction(act); | 162 | m_toolbar->addAction(act); | ||
163 | m_toolbar->addSeparator(); | 163 | m_toolbar->addSeparator(); | ||
164 | 164 | | |||
165 | act = m_actions->addAction("camera_cancel"); | 165 | act = m_actions->addAction("camera_cancel"); | ||
166 | act->setIcon(QIcon::fromTheme("process-stop")); | 166 | act->setIcon(QIcon::fromTheme("process-stop")); | ||
167 | act->setText(i18n("Cancel")); | 167 | act->setText(i18n("Cancel")); | ||
168 | connect(act, SIGNAL(triggered(bool)), this, SLOT(slot_cancelOperation())); | 168 | connect(act, &QAction::triggered, this, &KKameraConfig::slot_cancelOperation); | ||
169 | act->setWhatsThis(i18n("Click this button to cancel the current camera operation.")); | 169 | act->setWhatsThis(i18n("Click this button to cancel the current camera operation.")); | ||
170 | act->setEnabled(false); | 170 | act->setEnabled(false); | ||
171 | m_toolbar->addAction(act); | 171 | m_toolbar->addAction(act); | ||
172 | } | 172 | } | ||
173 | 173 | | |||
174 | void KKameraConfig::populateDeviceListView(void) | 174 | void KKameraConfig::populateDeviceListView(void) | ||
175 | { | 175 | { | ||
176 | m_deviceModel->clear(); | 176 | m_deviceModel->clear(); | ||
Show All 31 Lines | 202 | { | |||
208 | CameraAbilitiesList *al; | 208 | CameraAbilitiesList *al; | ||
209 | GPPortInfoList *il; | 209 | GPPortInfoList *il; | ||
210 | const char *model, *value; | 210 | const char *model, *value; | ||
211 | KCamera *kcamera; | 211 | KCamera *kcamera; | ||
212 | 212 | | |||
213 | for (it = groupList.begin(); it != groupList.end(); it++) { | 213 | for (it = groupList.begin(); it != groupList.end(); it++) { | ||
214 | if (*it != "<default>") { | 214 | if (*it != "<default>") { | ||
215 | KConfigGroup cg(m_config, *it); | 215 | KConfigGroup cg(m_config, *it); | ||
216 | if (cg.readEntry("Path").contains("usb:")) { | 216 | if (cg.readEntry("Path").contains("usb:")) { | ||
mlaurent: Fix indent here too | |||||
217 | continue; | 217 | continue; | ||
218 | } | 218 | } | ||
219 | 219 | | |||
220 | // Load configuration for Serial port cameras | 220 | // Load configuration for Serial port cameras | ||
221 | qCDebug(KAMERA_KCONTROL) << "Loading configuration for serial port camera: " | 221 | qCDebug(KAMERA_KCONTROL) << "Loading configuration for serial port camera: " | ||
222 | << *it; | 222 | << *it; | ||
223 | kcamera = new KCamera(*it, cg.readEntry("Path")); | 223 | kcamera = new KCamera(*it, cg.readEntry("Path")); | ||
224 | connect(kcamera, SIGNAL(error(QString)), SLOT(slot_error(QString))); | 224 | connect(kcamera, qOverload<const QString&>(&KCamera::error), | ||
225 | connect(kcamera, SIGNAL(error(QString,QString)), SLOT(slot_error(QString,QString))); | 225 | this, qOverload<const QString&>(&KKameraConfig::slot_error)); | ||
226 | | ||||
227 | connect(kcamera, qOverload<const QString&, const QString&>(&KCamera::error), | ||||
228 | this, qOverload<const QString&, const QString&>(&KKameraConfig::slot_error)); | ||||
229 | | ||||
226 | kcamera->load(m_config); | 230 | kcamera->load(m_config); | ||
227 | m_devices[*it] = kcamera; | 231 | m_devices[*it] = kcamera; | ||
228 | } | 232 | } | ||
229 | } | 233 | } | ||
230 | m_cancelPending = false; | 234 | m_cancelPending = false; | ||
231 | 235 | | |||
232 | gp_list_new (&list); | 236 | gp_list_new (&list); | ||
233 | 237 | | |||
Show All 24 Lines | |||||
258 | } | 262 | } | ||
259 | 263 | | |||
260 | QMap<QString,QString>::iterator portit; | 264 | QMap<QString,QString>::iterator portit; | ||
261 | 265 | | |||
262 | for (portit = ports.begin() ; portit != ports.end(); portit++) { | 266 | for (portit = ports.begin() ; portit != ports.end(); portit++) { | ||
263 | qCDebug(KAMERA_KCONTROL) << "Adding USB camera: " << portit.value() << " at " << portit.key(); | 267 | qCDebug(KAMERA_KCONTROL) << "Adding USB camera: " << portit.value() << " at " << portit.key(); | ||
264 | 268 | | |||
265 | kcamera = new KCamera(portit.value(), portit.key()); | 269 | kcamera = new KCamera(portit.value(), portit.key()); | ||
266 | connect(kcamera, SIGNAL(error(QString)), SLOT(slot_error(QString))); | 270 | | ||
267 | connect(kcamera, SIGNAL(error(QString,QString)), SLOT(slot_error(QString,QString))); | 271 | connect(kcamera, qOverload<const QString&>(&KCamera::error), | ||
272 | this, qOverload<const QString&>(&KKameraConfig::slot_error)); | ||||
273 | | ||||
274 | connect(kcamera, qOverload<const QString&, const QString&>(&KCamera::error), | ||||
275 | this, qOverload<const QString&, const QString&>(&KKameraConfig::slot_error)); | ||||
276 | | ||||
268 | m_devices[portit.value()] = kcamera; | 277 | m_devices[portit.value()] = kcamera; | ||
269 | } | 278 | } | ||
270 | populateDeviceListView(); | 279 | populateDeviceListView(); | ||
271 | 280 | | |||
272 | gp_list_free (list); | 281 | gp_list_free (list); | ||
273 | } | 282 | } | ||
274 | 283 | | |||
275 | void KKameraConfig::beforeCameraOperation(void) | 284 | void KKameraConfig::beforeCameraOperation(void) | ||
Show All 37 Lines | 320 | while (i++ < 0xffff) { | |||
313 | if (!m_devices.contains(new_name)) return new_name; | 322 | if (!m_devices.contains(new_name)) return new_name; | ||
314 | } | 323 | } | ||
315 | 324 | | |||
316 | return QString(); | 325 | return QString(); | ||
317 | } | 326 | } | ||
318 | 327 | | |||
319 | void KKameraConfig::slot_addCamera() | 328 | void KKameraConfig::slot_addCamera() | ||
320 | { | 329 | { | ||
321 | KCamera *m_device = new KCamera(QString::null, QString()); //krazy:exclusion=nullstrassign for old broken gcc | 330 | KCamera *m_device = new KCamera(QString(), QString()); | ||
322 | connect(m_device, SIGNAL(error(QString)), SLOT(slot_error(QString))); | 331 | connect(m_device, qOverload<const QString&>(&KCamera::error), | ||
323 | connect(m_device, SIGNAL(error(QString,QString)), SLOT(slot_error(QString,QString))); | 332 | this, qOverload<const QString&>(&KKameraConfig::slot_error)); | ||
333 | | ||||
334 | connect(m_device, qOverload<const QString&, const QString&>(&KCamera::error), | ||||
335 | this, qOverload<const QString&, const QString&>(&KKameraConfig::slot_error)); | ||||
336 | | ||||
324 | KameraDeviceSelectDialog dialog(this, m_device); | 337 | KameraDeviceSelectDialog dialog(this, m_device); | ||
325 | if (dialog.exec() == QDialog::Accepted) { | 338 | if (dialog.exec() == QDialog::Accepted) { | ||
326 | dialog.save(); | 339 | dialog.save(); | ||
327 | m_device->setName(suggestName(m_device->model())); | 340 | m_device->setName(suggestName(m_device->model())); | ||
328 | m_devices.insert(m_device->name(), m_device); | 341 | m_devices.insert(m_device->name(), m_device); | ||
329 | populateDeviceListView(); | 342 | populateDeviceListView(); | ||
330 | emit changed(true); | 343 | emit changed(true); | ||
331 | } else { | 344 | } else { | ||
▲ Show 20 Lines • Show All 129 Lines • Show Last 20 Lines |
Remove extra tab. Same for other lines