258 void MainView::stopHti() |
258 void MainView::stopHti() |
259 { |
259 { |
260 mEngineWrapper.stopHti(); |
260 mEngineWrapper.stopHti(); |
261 } |
261 } |
262 |
262 |
|
263 |
263 // --------------------------------------------------------------------------- |
264 // --------------------------------------------------------------------------- |
264 void MainView::enableComm() |
265 void MainView::enableComm() |
265 { |
266 { |
266 //Get current selection |
267 //Get current selection |
267 // QString currentComm; |
268 QString currentComm; |
268 // mEngineWrapper.getSelectedComm(currentComm); |
269 mEngineWrapper.getSelectedComm(currentComm); |
269 // int curSelection = mPluginList.indexOf(currentComm, 0); |
270 int curSelection = mPluginList.indexOf(currentComm, 0); |
270 // |
271 openListDialog(mPluginList, curSelection, QString("Select Comm"), this, SLOT(doSelectComm(HbAction*))); |
271 // QStringList selection; |
272 } |
272 // bool ok = false; |
273 |
273 // selection = HbListDialog::getStringItems("Select Comm", mPluginList, curSelection, &ok, HbAbstractItemView::SingleSelection); |
274 void MainView::doSelectComm(HbAction* action) |
274 // |
275 { |
275 // if(ok){ |
276 HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender()); |
276 // if(selection[0] == QString("Bt serial comm")){ |
277 if(dlg && dlg->selectedModelIndexes().count() && |
277 // enableBTComm(); |
278 (!action || action == dlg->actions().at(0))) |
278 // } |
279 { |
279 // else if(selection[0] == QString("IP comm")){ |
280 int selectionIndex = dlg->selectedModelIndexes().at(0).row(); |
280 // enableIPComm(); |
281 |
281 // } |
282 if (mPluginList[selectionIndex] == QString("Bt serial comm")) |
282 // else if(selection[0] == QString("SERIAL comm")){ |
283 { |
283 // enableSerialComm(); |
284 enableBTComm(); |
284 // } |
285 } |
285 // else{ |
286 else if (mPluginList[selectionIndex] == QString("IP comm")) |
286 // //All other comm plugins |
287 { |
287 // mEngineWrapper.enableOtherComm(selection[0]); |
288 enableIPComm(); |
288 // } |
289 } |
289 // } |
290 else if (mPluginList[selectionIndex] == QString("SERIAL comm")) |
290 } |
291 { |
291 |
292 enableSerialComm(); |
|
293 } |
|
294 else |
|
295 { |
|
296 //All other comm plugins |
|
297 mEngineWrapper.enableOtherComm(mPluginList[selectionIndex]); |
|
298 } |
|
299 } |
|
300 } |
292 // --------------------------------------------------------------------------- |
301 // --------------------------------------------------------------------------- |
293 void MainView::enableSerialComm() |
302 void MainView::enableSerialComm() |
294 { |
303 { |
295 // bool ok = false; |
304 QString heading = QString("Set Comm Port number"); |
296 // QString str = HbInputDialog::getText( |
305 HbInputDialog::getInteger(heading, this, SLOT(doEnableSerialComm(HbAction*)), 0, scene()); |
297 // "Set Comm Port number ", |
306 } |
298 // "", |
307 |
299 // &ok); |
308 void MainView::doEnableSerialComm(HbAction* action) |
300 // |
309 { |
301 // if(ok){ |
310 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
302 // mEngineWrapper.enableSerial(str); |
311 if (action == dlg->actions().at(0)) |
303 // } |
312 { |
304 } |
313 QString strPortNumber = dlg->value().toString(); |
305 |
314 mEngineWrapper.enableSerial(strPortNumber); |
306 |
315 } |
|
316 } |
307 // --------------------------------------------------------------------------- |
317 // --------------------------------------------------------------------------- |
308 void MainView::enableIPComm() |
318 void MainView::enableIPComm() |
309 { |
319 { |
310 // Get IAPs list |
320 // Get IAPs list |
311 // QStringList iapsList; |
321 QStringList iapsList; |
312 // mEngineWrapper.listIAPs(iapsList); |
322 mEngineWrapper.listIAPs(iapsList); |
313 // if(iapsList.count() == 0) |
323 if(iapsList.count() == 0) |
314 // { |
324 { |
315 // HbMessageBox msg("No IAPs for selection!", HbMessageBox::MessageTypeWarning); |
325 HbMessageBox::warning(QString("No IAPs for selection!")); |
316 // msg.exec(); |
326 return; |
317 // return; |
327 } |
318 // } |
328 |
319 // |
329 // Get current selection |
320 // // Get current selection |
330 QString curIapName; |
321 // QString curIapName; |
331 QString param = "IAPName"; |
322 // QString param = "IAPName"; |
332 mEngineWrapper.getIPCfgParam(param, curIapName); |
323 // mEngineWrapper.getIPCfgParam(param, curIapName); |
333 int curSelection = iapsList.indexOf(curIapName, 0); |
324 // int curSelction = iapsList.indexOf(curIapName, 0); |
334 |
325 // |
335 openListDialog(iapsList, curSelection, QString("Select IAP:"), this, SLOT(doSelectIAP(HbAction*))); |
326 // QString iap; |
336 } |
327 // QStringList selection; |
337 |
328 // bool ok = false; |
338 void MainView::doSelectIAP(HbAction* action) |
329 // selection = HbListDialog::getStringItems("Select IAP:", iapsList, curSelction, &ok, HbAbstractItemView::SingleSelection); |
339 { |
330 // |
340 HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender()); |
331 // if(ok) |
341 if(dlg && dlg->selectedModelIndexes().count() && |
332 // { |
342 (!action || action == dlg->actions().at(0))) |
333 // iap = selection[0]; |
343 { |
334 // } |
344 int selectionIndex = dlg->selectedModelIndexes().at(0).row(); |
335 // else |
345 mIapSelection = dlg->stringItems()[selectionIndex]; |
336 // { |
346 |
337 // return; |
347 QStringList items; |
338 // } |
348 items <<"Listen" <<"Connect"; |
339 // |
349 openListDialog(items, 0, QString("Select IP Comm"), this, SLOT(doSelectIpComm(HbAction*))); |
340 // QStringList srcList; |
350 } |
341 // srcList <<"Listen" <<"Connect"; |
351 } |
342 // |
352 |
343 // selection = HbListDialog::getStringItems("Select IP Comm", srcList, 0, &ok, HbAbstractItemView::SingleSelection); |
353 void MainView::doSelectIpComm(HbAction* action) |
344 // |
354 { |
345 // if(ok){ |
355 HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender()); |
346 // if(selection[0] == srcList[0]){ |
356 if(dlg && dlg->selectedModelIndexes().count() && |
347 // QString port = HbInputDialog::getText( |
357 (!action || action == dlg->actions().at(0))) |
348 // "Local port", |
358 { |
349 // "", |
359 int selectionIndex = dlg->selectedModelIndexes().at(0).row(); |
350 // &ok); |
360 if(selectionIndex == 0) //Listen |
351 // |
361 { |
352 // if(ok){ |
362 HbInputDialog::getInteger(QString("Local port"), this, SLOT(doListenOnPort(HbAction*)), 0, scene()); |
353 // mEngineWrapper.ipListen(port, iap); |
363 } |
354 // } |
364 else //Connect |
355 // |
365 { |
356 // } |
366 openIPAddressDialog(QString("Remote Host"), this, SLOT(doConnectRemoteHost(HbAction*))); |
357 // else{ |
367 } |
358 // QString host = HbInputDialog::getText( |
368 } |
359 // "Remote Host", |
369 } |
360 // "", |
370 |
361 // &ok); |
371 void MainView::doListenOnPort(HbAction* action) |
362 // |
372 { |
363 // if(ok){ |
373 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
364 // QString port = HbInputDialog::getText( |
374 if (action == dlg->actions().at(0)) |
365 // "Remote port", |
375 { |
366 // "", |
376 QString port = dlg->value().toString(); |
367 // &ok); |
377 mEngineWrapper.ipListen(port, mIapSelection); |
368 // |
378 } |
369 // if(ok){ |
379 } |
370 // mEngineWrapper.ipConnect(host, port, iap); |
380 |
371 // } |
381 void MainView::doConnectRemoteHost(HbAction* action) |
372 // } |
382 { |
373 // } |
383 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
374 // |
384 if (action == dlg->actions().at(0)) |
375 // } |
385 { |
|
386 QString host = dlg->value(0).toString(); |
|
387 QString port = dlg->value(1).toString(); |
|
388 mEngineWrapper.ipConnect(host, port, mIapSelection); |
|
389 } |
376 } |
390 } |
377 |
391 |
378 // --------------------------------------------------------------------------- |
392 // --------------------------------------------------------------------------- |
379 void MainView::enableBTComm() |
393 void MainView::enableBTComm() |
380 { |
394 { |
381 // QStringList srcList; |
395 QStringList items; |
382 // QStringList selection; |
396 items <<"BT address" <<"BT name" <<"Search when starting" ; |
383 // |
397 openListDialog(items, 0, QString("Bluetooth Comm"), this, SLOT(doSelectBTComm(HbAction*))); |
384 // srcList <<"BT address" <<"BT name" <<"Search when starting" ; |
398 } |
385 // |
399 |
386 // bool ok = false; |
400 void MainView::doSelectBTComm(HbAction* action) |
387 // selection = HbListDialog::getStringItems("", srcList, 0, &ok, HbAbstractItemView::SingleSelection); |
401 { |
388 // |
402 HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender()); |
389 // if(ok){ |
403 if(dlg && dlg->selectedModelIndexes().count() && |
390 // if(selection[0] == srcList[0]){ |
404 (!action || action == dlg->actions().at(0))) |
391 // QString address = HbInputDialog::getText( |
405 { |
392 // "BT address", |
406 int selectionIndex = dlg->selectedModelIndexes().at(0).row(); |
393 // "", |
407 if(selectionIndex == 0) |
394 // &ok); |
408 { |
395 // |
409 HbInputDialog::getText(QString("BT address"), this, SLOT(doEnableByBTAddress(HbAction*))); |
396 // if(ok){ |
410 } |
397 // mEngineWrapper.enableBtByAddress(address); |
411 else if(selectionIndex == 1) |
398 // } |
412 { |
399 // } |
413 HbInputDialog::getText(QString("BT name"), this, SLOT(doEnableByBTName(HbAction*))); |
400 // else if(selection[0] == srcList[1]){ |
414 } |
401 // QString name = HbInputDialog::getText( |
415 else if(selectionIndex == 2) |
402 // "BT name", |
416 { |
403 // "", |
417 mEngineWrapper.btSearch(); |
404 // &ok); |
418 } |
405 // |
419 } |
406 // if(ok){ |
420 } |
407 // mEngineWrapper.enableBtByName(name); |
421 |
408 // } |
422 void MainView::doEnableByBTAddress(HbAction* action) |
409 // } |
423 { |
410 // else if(selection[0] == srcList[2]){ |
424 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
411 // mEngineWrapper.btSearch(); |
425 if (action == dlg->actions().at(0)) |
412 // } |
426 { |
413 // } |
427 QString address = dlg->value().toString(); |
414 } |
428 mEngineWrapper.enableBtByAddress(address); |
415 |
429 } |
|
430 } |
|
431 void MainView::doEnableByBTName(HbAction* action) |
|
432 { |
|
433 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
|
434 if (action == dlg->actions().at(0)) |
|
435 { |
|
436 QString name = dlg->value().toString(); |
|
437 mEngineWrapper.enableBtByName(name); |
|
438 } |
|
439 } |
416 |
440 |
417 // --------------------------------------------------------------------------- |
441 // --------------------------------------------------------------------------- |
418 void MainView::setPriority() |
442 void MainView::setPriority() |
419 { |
443 { |
420 // Get current priority |
444 // Get current priority |
421 // bool ok = false; |
445 bool ok = false; |
422 // QString curPriority; |
446 QString curPriority; |
423 // QString param = "Priority"; |
447 QString param = "Priority"; |
424 // mEngineWrapper.getHtiCfgParam(param, curPriority); |
448 mEngineWrapper.getHtiCfgParam(param, curPriority); |
425 // int curSelection = curPriority.toInt(&ok); |
449 int curSelection = curPriority.toInt(&ok); |
426 // if(ok){ |
450 if(ok){ |
427 // curSelection--; |
451 curSelection--; |
428 // } |
452 } |
429 // else{ |
453 else{ |
430 // curSelection = 2; |
454 curSelection = 2; |
431 // } |
455 } |
432 // |
456 |
433 // QStringList srcList; |
457 QStringList items; |
434 // QStringList selection; |
458 items <<"Backgroung" <<"Foregound" <<"High" << "Absolute High"; |
435 // |
459 openListDialog(items, curSelection, QString("Select Hti Priority"), |
436 // srcList <<"Backgroung" <<"Foregound" <<"High" << "Absolute High"; |
460 this, SLOT(doSetPriority(HbAction*))); |
437 // |
461 } |
438 // |
462 |
439 // selection = HbListDialog::getStringItems("Select Hti Priority", srcList, curSelection, &ok, HbAbstractItemView::SingleSelection); |
463 void MainView::doSetPriority(HbAction* action) |
440 // |
464 { |
441 // if(ok){ |
465 HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender()); |
442 // if(selection[0] == srcList[0]){ |
466 if(dlg && dlg->selectedModelIndexes().count() && |
443 // mEngineWrapper.setPriorityBackground(); |
467 (!action || action == dlg->actions().at(0))) |
444 // } |
468 { |
445 // else if(selection[0] == srcList[1]){ |
469 int selectionIndex = dlg->selectedModelIndexes().at(0).row(); |
446 // mEngineWrapper.setPriorityForeground(); |
470 if(selectionIndex == 0) |
447 // } |
471 { |
448 // else if(selection[0] == srcList[2]){ |
472 mEngineWrapper.setPriorityBackground(); |
449 // mEngineWrapper.setPriorityHigh(); |
473 } |
450 // } |
474 else if(selectionIndex == 1) |
451 // else{ |
475 { |
452 // mEngineWrapper.setPriorityAbsoluteHigh(); |
476 mEngineWrapper.setPriorityForeground(); |
453 // } |
477 } |
454 // } |
478 else if(selectionIndex == 2) |
455 } |
479 { |
456 |
480 mEngineWrapper.setPriorityHigh(); |
|
481 } |
|
482 else |
|
483 { |
|
484 mEngineWrapper.setPriorityAbsoluteHigh(); |
|
485 } |
|
486 } |
|
487 } |
457 // --------------------------------------------------------------------------- |
488 // --------------------------------------------------------------------------- |
458 void MainView::enableAutoStart() |
489 void MainView::enableAutoStart() |
459 { |
490 { |
460 mEngineWrapper.autoStartEnable(true); |
491 mEngineWrapper.autoStartEnable(true); |
461 } |
492 } |
491 } |
522 } |
492 |
523 |
493 // --------------------------------------------------------------------------- |
524 // --------------------------------------------------------------------------- |
494 void MainView::showParamList() |
525 void MainView::showParamList() |
495 { |
526 { |
496 // QStringList srcList; |
527 QStringList items; |
497 // QStringList selection; |
528 items << "Hti.cfg" << "HtiBtComm.cfg" << "HtiSerialComm.cfg" << "HtiIPComm.cfg"; |
498 // QString value; |
529 openListDialog(items, 0, QString("Select cfg file to modify"), |
499 // QString name; |
530 this, SLOT(doSelectCfgFile(HbAction*))); |
500 // QString cfgSelection; |
531 } |
501 // QString paramSelection; |
532 |
502 // QString cfgHti = "Hti.cfg"; |
533 void MainView::doSelectCfgFile(HbAction* action) |
503 // QString cfgBtComm ="HtiBtComm.cfg"; |
534 { |
504 // QString cfgSerialComm = "HtiSerialComm.cfg"; |
535 HbSelectionDialog *dlg = static_cast<HbSelectionDialog*>(sender()); |
505 // QString cfgIPComm = "HtiIPComm.cfg"; |
536 if(dlg && dlg->selectedModelIndexes().count() && |
506 // |
537 (!action || action == dlg->actions().at(0))) |
507 // srcList <<cfgHti <<cfgBtComm <<cfgSerialComm << cfgIPComm; |
538 { |
508 // |
539 int selectionIndex = dlg->selectedModelIndexes().at(0).row(); |
509 // bool ok = false; |
540 QStringList items; |
510 // selection = HbListDialog::getStringItems("Select cfg file to modify", srcList, 0, &ok, HbAbstractItemView::SingleSelection); |
541 if(selectionIndex == 0) |
511 // |
542 { |
512 // if(ok){ |
543 items <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority" |
513 // cfgSelection = selection[0]; |
544 <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog" |
514 // srcList.clear(); |
545 <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay"; |
515 // if(cfgSelection == cfgHti){ |
546 openListDialog(items, 0, QString("Hti.cfg"), this, SLOT(doModifyHtiCfgFile(HbAction*))); |
516 // srcList <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority" |
547 } |
517 // <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog" |
548 else if(selectionIndex == 1) |
518 // <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay"; |
549 { |
519 // } |
550 items <<"BtDeviceName" <<"BtDeviceName"; |
520 // else if(cfgSelection == cfgBtComm){ |
551 openListDialog(items, 0, QString("HtiBtComm.cfg"), this, SLOT(doModifyBtCfgFile(HbAction*))); |
521 // srcList <<"BtDeviceName" <<"BtDeviceName"; |
552 } |
522 // } |
553 else if(selectionIndex == 2) |
523 // else if(cfgSelection == cfgSerialComm){ |
554 { |
524 // srcList <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake"; |
555 items <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake"; |
525 // } |
556 openListDialog(items, 0, QString("HtiSerialComm.cfg"), this, SLOT(doModifySerialCfgFile(HbAction*))); |
526 // else{ |
557 } |
527 // srcList <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout"; |
558 else |
528 // } |
559 { |
529 // |
560 items <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout"; |
530 // selection = HbListDialog::getStringItems("Select a parameter name in" + cfgSelection, srcList, 0, &ok, HbAbstractItemView::SingleSelection); |
561 openListDialog(items, 0, QString("HtiIPComm.cfg"), this, SLOT(doModifyIPCfgFile(HbAction*))); |
531 // } |
562 } |
532 // |
563 } |
533 // if(ok){ |
564 } |
534 // name = selection[0]; |
565 |
535 // value = HbInputDialog::getText("Value for paramater " + name, "", &ok); |
566 void MainView::doModifyHtiCfgFile(HbAction* action) |
536 // } |
567 { |
537 // |
568 HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender()); |
538 // if(ok){ |
569 if(dlgSelection && dlgSelection->selectedModelIndexes().count() && |
539 // if(cfgSelection == cfgHti){ |
570 (!action || action == dlgSelection->actions().at(0))) |
540 // mEngineWrapper.setHtiCfgParam(name, value); |
571 { |
541 // } |
572 int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row(); |
542 // else if(cfgSelection == cfgBtComm){ |
573 HbInputDialog* dlgInput = new HbInputDialog(); |
543 // mEngineWrapper.setBtCfgParam(name, value); |
574 dlgInput->setAttribute(Qt::WA_DeleteOnClose); |
544 // } |
575 dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]); |
545 // else if(cfgSelection == cfgSerialComm){ |
576 dlgInput->setInputMode(HbInputDialog::TextInput); |
546 // mEngineWrapper.setSerialCfgParam(name, value); |
577 |
547 // } |
578 HbLabel *title = new HbLabel(dlgInput); |
548 // else{ |
579 title->setPlainText(QString("Set parameter value")); |
549 // mEngineWrapper.setIPCfgParam(name, value); |
580 dlgInput->setHeadingWidget(title); |
550 // } |
581 |
551 // } |
582 dlgInput->open(this, SLOT(doSetHtiCfgParameter(HbAction*))); |
552 } |
583 } |
553 |
584 } |
554 |
585 |
|
586 void MainView::doSetHtiCfgParameter(HbAction* action) |
|
587 { |
|
588 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
|
589 if (action == dlg->actions().at(0)) |
|
590 { |
|
591 QString parameter = dlg->promptText(); |
|
592 QString value = dlg->value().toString(); |
|
593 mEngineWrapper.setHtiCfgParam(parameter, value); |
|
594 } |
|
595 } |
|
596 |
|
597 void MainView::doModifyBtCfgFile(HbAction* action) |
|
598 { |
|
599 HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender()); |
|
600 if(dlgSelection && dlgSelection->selectedModelIndexes().count() && |
|
601 (!action || action == dlgSelection->actions().at(0))) |
|
602 { |
|
603 int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row(); |
|
604 HbInputDialog* dlgInput = new HbInputDialog(); |
|
605 dlgInput->setAttribute(Qt::WA_DeleteOnClose); |
|
606 dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]); |
|
607 dlgInput->setInputMode(HbInputDialog::TextInput); |
|
608 |
|
609 HbLabel *title = new HbLabel(dlgInput); |
|
610 title->setPlainText(QString("Set parameter value")); |
|
611 dlgInput->setHeadingWidget(title); |
|
612 |
|
613 dlgInput->open(this, SLOT(doSetBtCfgParameter(HbAction*))); |
|
614 } |
|
615 } |
|
616 |
|
617 void MainView::doSetBtCfgParameter(HbAction* action) |
|
618 { |
|
619 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
|
620 if (action == dlg->actions().at(0)) |
|
621 { |
|
622 QString parameter = dlg->promptText(); |
|
623 QString value = dlg->value().toString(); |
|
624 mEngineWrapper.setBtCfgParam(parameter, value); |
|
625 } |
|
626 } |
|
627 |
|
628 void MainView::doModifySerialCfgFile(HbAction* action) |
|
629 { |
|
630 HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender()); |
|
631 if(dlgSelection && dlgSelection->selectedModelIndexes().count() && |
|
632 (!action || action == dlgSelection->actions().at(0))) |
|
633 { |
|
634 int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row(); |
|
635 HbInputDialog* dlgInput = new HbInputDialog(); |
|
636 dlgInput->setAttribute(Qt::WA_DeleteOnClose); |
|
637 dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]); |
|
638 dlgInput->setInputMode(HbInputDialog::TextInput); |
|
639 |
|
640 HbLabel *title = new HbLabel(dlgInput); |
|
641 title->setPlainText(QString("Set parameter value")); |
|
642 dlgInput->setHeadingWidget(title); |
|
643 |
|
644 dlgInput->open(this, SLOT(doSetSerialCfgParameter(HbAction*))); |
|
645 } |
|
646 } |
|
647 |
|
648 void MainView::doSetSerialCfgParameter(HbAction* action) |
|
649 { |
|
650 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
|
651 if (action == dlg->actions().at(0)) |
|
652 { |
|
653 QString parameter = dlg->promptText(); |
|
654 QString value = dlg->value().toString(); |
|
655 mEngineWrapper.setSerialCfgParam(parameter, value); |
|
656 } |
|
657 } |
|
658 |
|
659 void MainView::doModifyIPCfgFile(HbAction* action) |
|
660 { |
|
661 HbSelectionDialog *dlgSelection = static_cast<HbSelectionDialog*>(sender()); |
|
662 if(dlgSelection && dlgSelection->selectedModelIndexes().count() && |
|
663 (!action || action == dlgSelection->actions().at(0))) |
|
664 { |
|
665 int selectionIndex = dlgSelection->selectedModelIndexes().at(0).row(); |
|
666 HbInputDialog* dlgInput = new HbInputDialog(); |
|
667 dlgInput->setAttribute(Qt::WA_DeleteOnClose); |
|
668 dlgInput->setPromptText(dlgSelection->stringItems()[selectionIndex]); |
|
669 dlgInput->setInputMode(HbInputDialog::TextInput); |
|
670 |
|
671 HbLabel *title = new HbLabel(dlgInput); |
|
672 title->setPlainText(QString("Set parameter value")); |
|
673 dlgInput->setHeadingWidget(title); |
|
674 |
|
675 dlgInput->open(this, SLOT(doSetIPCfgParameter(HbAction*))); |
|
676 } |
|
677 } |
|
678 |
|
679 void MainView::doSetIPCfgParameter(HbAction* action) |
|
680 { |
|
681 HbInputDialog *dlg = static_cast<HbInputDialog*>(sender()); |
|
682 if (action == dlg->actions().at(0)) |
|
683 { |
|
684 QString parameter = dlg->promptText(); |
|
685 QString value = dlg->value().toString(); |
|
686 mEngineWrapper.setIPCfgParam(parameter, value); |
|
687 } |
|
688 } |
|
689 |
|
690 void MainView::openListDialog(const QStringList& items, const int currentSelection, |
|
691 const QString &titleText, QObject* receiver, const char* member) |
|
692 { |
|
693 // Create a list and some simple content for it |
|
694 HbSelectionDialog *dlg = new HbSelectionDialog(); |
|
695 dlg->setAttribute(Qt::WA_DeleteOnClose); |
|
696 // Set items to be popup's content |
|
697 dlg->setStringItems(items); |
|
698 dlg->setSelectionMode(HbAbstractItemView::SingleSelection); |
|
699 QList<QVariant> current; |
|
700 current.append(QVariant(currentSelection)); |
|
701 dlg->setSelectedItems(current); |
|
702 |
|
703 HbLabel *title = new HbLabel(dlg); |
|
704 title->setPlainText(titleText); |
|
705 dlg->setHeadingWidget(title); |
|
706 |
|
707 // Launch popup and handle the user response: |
|
708 dlg->open(receiver, member); |
|
709 } |
|
710 |
|
711 void MainView::openIPAddressDialog(const QString &titleText, QObject* receiver, const char* member) |
|
712 { |
|
713 HbInputDialog* dlg = new HbInputDialog(); |
|
714 dlg->setAttribute(Qt::WA_DeleteOnClose); |
|
715 dlg->setAdditionalRowVisible(true); |
|
716 dlg->setPromptText(QString("IP Address:"), 0); |
|
717 dlg->setInputMode(HbInputDialog::IpInput, 0); |
|
718 dlg->setPromptText(QString("Port:"), 1); |
|
719 dlg->setInputMode(HbInputDialog::IntInput, 1); |
|
720 |
|
721 HbLabel *title = new HbLabel(dlg); |
|
722 title->setPlainText(titleText); |
|
723 dlg->setHeadingWidget(title); |
|
724 |
|
725 dlg->open(receiver, member); |
|
726 } |