htiui/HtiAdminQt/mainview.cpp
branchRCL_3
changeset 12 aefcba28a3e0
parent 11 454d022d514b
child 17 65b472535a0d
equal deleted inserted replaced
11:454d022d514b 12:aefcba28a3e0
    19 #include <hbmainwindow.h>
    19 #include <hbmainwindow.h>
    20 #include <hbapplication.h>
    20 #include <hbapplication.h>
    21 #include <hbmenu.h>
    21 #include <hbmenu.h>
    22 #include <hbaction.h>
    22 #include <hbaction.h>
    23 #include <hblabel.h>
    23 #include <hblabel.h>
    24 #include <HbInputDialog.h>
    24 #include <hbinputdialog.h>
    25 #include <qgraphicslinearlayout.h>
    25 #include <qgraphicslinearlayout.h>
    26 #include <HbListDialog.h>
    26 //#include <HbListDialog.h>
    27 #include <hbmessagebox.h>
    27 #include <hbmessagebox.h>
    28 
    28 
    29 
    29 
    30 
    30 
    31 #include "htienginewrapper.h"
    31 #include "htienginewrapper.h"
   262 
   262 
   263 // ---------------------------------------------------------------------------
   263 // ---------------------------------------------------------------------------
   264 void MainView::enableComm()
   264 void MainView::enableComm()
   265 {
   265 {
   266     //Get current selection
   266     //Get current selection
   267 	QString currentComm;
   267 //	QString currentComm;
   268 	mEngineWrapper.getSelectedComm(currentComm);
   268 //	mEngineWrapper.getSelectedComm(currentComm);
   269 	int curSelection = mPluginList.indexOf(currentComm, 0);
   269 //	int curSelection = mPluginList.indexOf(currentComm, 0);
   270 	
   270 //	
   271 	QStringList selection;
   271 //	QStringList selection;
   272 	bool ok = false;
   272 //	bool ok = false;
   273 	selection = HbListDialog::getStringItems("Select Comm", mPluginList, curSelection, &ok, HbAbstractItemView::SingleSelection);
   273 //	selection = HbListDialog::getStringItems("Select Comm", mPluginList, curSelection, &ok, HbAbstractItemView::SingleSelection);
   274 		
   274 //		
   275 	if(ok){
   275 //	if(ok){
   276 			if(selection[0] == QString("Bt serial comm")){
   276 //			if(selection[0] == QString("Bt serial comm")){
   277 				enableBTComm();
   277 //				enableBTComm();
   278 			}
   278 //			}
   279 			else if(selection[0] == QString("IP comm")){
   279 //			else if(selection[0] == QString("IP comm")){
   280 				enableIPComm();
   280 //				enableIPComm();
   281 			}
   281 //			}
   282 			else if(selection[0] == QString("SERIAL comm")){
   282 //			else if(selection[0] == QString("SERIAL comm")){
   283 				enableSerialComm();
   283 //				enableSerialComm();
   284 			}
   284 //			}
   285 			else{
   285 //			else{
   286 				//All other comm plugins
   286 //				//All other comm plugins
   287 				mEngineWrapper.enableOtherComm(selection[0]);
   287 //				mEngineWrapper.enableOtherComm(selection[0]);
   288 			}	
   288 //			}	
   289 		}
   289 //		}
   290 }
   290 }
   291 
   291 
   292 // ---------------------------------------------------------------------------
   292 // ---------------------------------------------------------------------------
   293 void MainView::enableSerialComm()
   293 void MainView::enableSerialComm()
   294 {
   294 {
   295 	bool ok = false;
   295 //	bool ok = false;
   296     QString str = HbInputDialog::getText(
   296 //    QString str = HbInputDialog::getText(
   297 					"Set Comm Port number ",
   297 //					"Set Comm Port number ",
   298 					"",
   298 //					"",
   299 					&ok);
   299 //					&ok);
   300     
   300 //    
   301     if(ok){
   301 //    if(ok){
   302     	mEngineWrapper.enableSerial(str);
   302 //    	mEngineWrapper.enableSerial(str);
   303     }
   303 //    }
   304 }
   304 }
   305 
   305 
   306 
   306 
   307 // ---------------------------------------------------------------------------
   307 // ---------------------------------------------------------------------------
   308 void MainView::enableIPComm()
   308 void MainView::enableIPComm()
   309 {
   309 {
   310     // Get IAPs list
   310     // Get IAPs list
   311     QStringList iapsList;
   311 //    QStringList iapsList;
   312     mEngineWrapper.listIAPs(iapsList); 
   312 //    mEngineWrapper.listIAPs(iapsList); 
   313     if(iapsList.count() == 0)
   313 //    if(iapsList.count() == 0)
   314     {
   314 //    {
   315         HbMessageBox msg("No IAPs for selection!", HbMessageBox::MessageTypeWarning);
   315 //        HbMessageBox msg("No IAPs for selection!", HbMessageBox::MessageTypeWarning);
   316         msg.exec();
   316 //        msg.exec();
   317         return;
   317 //        return;
   318     }
   318 //    }
   319     
   319 //    
   320     // Get current selection
   320 //    // Get current selection
   321     QString curIapName;
   321 //    QString curIapName;
   322     QString param = "IAPName";
   322 //    QString param = "IAPName";
   323     mEngineWrapper.getIPCfgParam(param, curIapName);
   323 //    mEngineWrapper.getIPCfgParam(param, curIapName);
   324     int curSelction = iapsList.indexOf(curIapName, 0);
   324 //    int curSelction = iapsList.indexOf(curIapName, 0);
   325     
   325 //    
   326     QString iap;
   326 //    QString iap;
   327 	QStringList selection;
   327 //	QStringList selection;
   328 	bool ok = false;
   328 //	bool ok = false;
   329 	selection = HbListDialog::getStringItems("Select IAP:", iapsList, curSelction, &ok, HbAbstractItemView::SingleSelection);
   329 //	selection = HbListDialog::getStringItems("Select IAP:", iapsList, curSelction, &ok, HbAbstractItemView::SingleSelection);
   330 	
   330 //	
   331 	if(ok)
   331 //	if(ok)
   332 	{
   332 //	{
   333         iap = selection[0];
   333 //        iap = selection[0];
   334 	}
   334 //	}
   335 	else
   335 //	else
   336 	{
   336 //	{
   337         return;
   337 //        return;
   338 	}
   338 //	}
   339 	
   339 //	
   340 	QStringList srcList;
   340 //	QStringList srcList;
   341 	srcList <<"Listen" <<"Connect";
   341 //	srcList <<"Listen" <<"Connect";
   342 	
   342 //	
   343 	selection = HbListDialog::getStringItems("Select IP Comm", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
   343 //	selection = HbListDialog::getStringItems("Select IP Comm", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
   344 	
   344 //	
   345 	if(ok){
   345 //	if(ok){
   346 		if(selection[0] == srcList[0]){
   346 //		if(selection[0] == srcList[0]){
   347 			QString port = HbInputDialog::getText(
   347 //			QString port = HbInputDialog::getText(
   348 								"Local port",
   348 //								"Local port",
   349 								"",
   349 //								"",
   350 								&ok);	
   350 //								&ok);	
   351 		
   351 //		
   352 			if(ok){
   352 //			if(ok){
   353 				mEngineWrapper.ipListen(port, iap);
   353 //				mEngineWrapper.ipListen(port, iap);
   354 			}
   354 //			}
   355 			
   355 //			
   356 		}
   356 //		}
   357 		else{
   357 //		else{
   358 			QString host = HbInputDialog::getText(
   358 //			QString host = HbInputDialog::getText(
   359 								"Remote Host",
   359 //								"Remote Host",
   360 								"",
   360 //								"",
   361 								&ok);	
   361 //								&ok);	
   362 					
   362 //					
   363 			if(ok){
   363 //			if(ok){
   364 				QString port = HbInputDialog::getText(
   364 //				QString port = HbInputDialog::getText(
   365 												"Remote port",
   365 //												"Remote port",
   366 												"",
   366 //												"",
   367 												&ok);	
   367 //												&ok);	
   368 			
   368 //			
   369 				if(ok){
   369 //				if(ok){
   370 					mEngineWrapper.ipConnect(host, port, iap);
   370 //					mEngineWrapper.ipConnect(host, port, iap);
   371 				}
   371 //				}
   372 			}
   372 //			}
   373 		}
   373 //		}
   374 			
   374 //			
   375 	}
   375 //	}
   376 }
   376 }
   377 
   377 
   378 // ---------------------------------------------------------------------------
   378 // ---------------------------------------------------------------------------
   379 void MainView::enableBTComm()
   379 void MainView::enableBTComm()
   380 {
   380 {
   381 	QStringList srcList;
   381 //	QStringList srcList;
   382 	QStringList selection;
   382 //	QStringList selection;
   383 	 
   383 //	 
   384 	srcList <<"BT address" <<"BT name" <<"Search when starting" ;
   384 //	srcList <<"BT address" <<"BT name" <<"Search when starting" ;
   385 	
   385 //	
   386 	bool ok = false;
   386 //	bool ok = false;
   387 	selection = HbListDialog::getStringItems("", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
   387 //	selection = HbListDialog::getStringItems("", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
   388 	
   388 //	
   389 	if(ok){
   389 //	if(ok){
   390 		if(selection[0] == srcList[0]){
   390 //		if(selection[0] == srcList[0]){
   391 			QString address = HbInputDialog::getText(
   391 //			QString address = HbInputDialog::getText(
   392 						"BT address",
   392 //						"BT address",
   393 						"",
   393 //						"",
   394 						&ok);
   394 //						&ok);
   395 		
   395 //		
   396 			if(ok){
   396 //			if(ok){
   397 				mEngineWrapper.enableBtByAddress(address);	
   397 //				mEngineWrapper.enableBtByAddress(address);	
   398 			}
   398 //			}
   399 		}
   399 //		}
   400 		else if(selection[0] == srcList[1]){
   400 //		else if(selection[0] == srcList[1]){
   401 			QString name = HbInputDialog::getText(
   401 //			QString name = HbInputDialog::getText(
   402 								"BT name",
   402 //								"BT name",
   403 								"",
   403 //								"",
   404 								&ok);
   404 //								&ok);
   405 				
   405 //				
   406 					if(ok){
   406 //					if(ok){
   407 						mEngineWrapper.enableBtByName(name);	
   407 //						mEngineWrapper.enableBtByName(name);	
   408 					}
   408 //					}
   409 		}
   409 //		}
   410 		else if(selection[0] == srcList[2]){
   410 //		else if(selection[0] == srcList[2]){
   411 			mEngineWrapper.btSearch();
   411 //			mEngineWrapper.btSearch();
   412 		}
   412 //		}
   413 	}
   413 //	}
   414 }
   414 }
   415 
   415 
   416 
   416 
   417 // ---------------------------------------------------------------------------
   417 // ---------------------------------------------------------------------------
   418 void MainView::setPriority()
   418 void MainView::setPriority()
   419 {
   419 {
   420     // Get current priority
   420     // Get current priority
   421     bool ok = false;
   421 //    bool ok = false;
   422     QString curPriority;
   422 //    QString curPriority;
   423     QString param = "Priority";
   423 //    QString param = "Priority";
   424     mEngineWrapper.getHtiCfgParam(param, curPriority);
   424 //    mEngineWrapper.getHtiCfgParam(param, curPriority);
   425     int curSelection = curPriority.toInt(&ok);
   425 //    int curSelection = curPriority.toInt(&ok);
   426     if(ok){
   426 //    if(ok){
   427         curSelection--;
   427 //        curSelection--;
   428     }
   428 //    }
   429     else{
   429 //    else{
   430     curSelection = 2;
   430 //    curSelection = 2;
   431     }
   431 //    }
   432     
   432 //    
   433 	QStringList srcList;
   433 //	QStringList srcList;
   434 	QStringList selection;
   434 //	QStringList selection;
   435 	 
   435 //	 
   436 	srcList <<"Backgroung" <<"Foregound" <<"High" << "Absolute High";
   436 //	srcList <<"Backgroung" <<"Foregound" <<"High" << "Absolute High";
   437 	
   437 //	
   438 	
   438 //	
   439 	selection = HbListDialog::getStringItems("Select Hti Priority", srcList, curSelection, &ok, HbAbstractItemView::SingleSelection);
   439 //	selection = HbListDialog::getStringItems("Select Hti Priority", srcList, curSelection, &ok, HbAbstractItemView::SingleSelection);
   440 	
   440 //	
   441 	if(ok){
   441 //	if(ok){
   442 		if(selection[0] == srcList[0]){
   442 //		if(selection[0] == srcList[0]){
   443 			mEngineWrapper.setPriorityBackground();
   443 //			mEngineWrapper.setPriorityBackground();
   444 		}
   444 //		}
   445 		else if(selection[0] == srcList[1]){
   445 //		else if(selection[0] == srcList[1]){
   446 					mEngineWrapper.setPriorityForeground();
   446 //					mEngineWrapper.setPriorityForeground();
   447 		}
   447 //		}
   448 		else if(selection[0] == srcList[2]){
   448 //		else if(selection[0] == srcList[2]){
   449 			mEngineWrapper.setPriorityHigh();
   449 //			mEngineWrapper.setPriorityHigh();
   450 		}
   450 //		}
   451 		else{
   451 //		else{
   452 			mEngineWrapper.setPriorityAbsoluteHigh();
   452 //			mEngineWrapper.setPriorityAbsoluteHigh();
   453 		}	
   453 //		}	
   454 	}
   454 //	}
   455 }
   455 }
   456 
   456 
   457 // ---------------------------------------------------------------------------
   457 // ---------------------------------------------------------------------------
   458 void MainView::enableAutoStart()
   458 void MainView::enableAutoStart()
   459 {
   459 {
   491 }
   491 }
   492 
   492 
   493 // ---------------------------------------------------------------------------
   493 // ---------------------------------------------------------------------------
   494 void MainView::showParamList()
   494 void MainView::showParamList()
   495 {
   495 {
   496 	QStringList srcList;
   496 //	QStringList srcList;
   497 	QStringList selection;
   497 //	QStringList selection;
   498 	QString value;
   498 //	QString value;
   499 	QString name;
   499 //	QString name;
   500 	QString cfgSelection;
   500 //	QString cfgSelection;
   501 	QString paramSelection;
   501 //	QString paramSelection;
   502 	QString cfgHti = "Hti.cfg";
   502 //	QString cfgHti = "Hti.cfg";
   503 	QString cfgBtComm ="HtiBtComm.cfg";
   503 //	QString cfgBtComm ="HtiBtComm.cfg";
   504 	QString cfgSerialComm = "HtiSerialComm.cfg";
   504 //	QString cfgSerialComm = "HtiSerialComm.cfg";
   505 	QString cfgIPComm = "HtiIPComm.cfg";
   505 //	QString cfgIPComm = "HtiIPComm.cfg";
   506 	 
   506 //	 
   507 	srcList <<cfgHti <<cfgBtComm <<cfgSerialComm << cfgIPComm;
   507 //	srcList <<cfgHti <<cfgBtComm <<cfgSerialComm << cfgIPComm;
   508 	
   508 //	
   509 	bool ok = false;
   509 //	bool ok = false;
   510 	selection = HbListDialog::getStringItems("Select cfg file to modify", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
   510 //	selection = HbListDialog::getStringItems("Select cfg file to modify", srcList, 0, &ok, HbAbstractItemView::SingleSelection);
   511 	
   511 //	
   512 	if(ok){
   512 //	if(ok){
   513         cfgSelection = selection[0];
   513 //        cfgSelection = selection[0];
   514         srcList.clear();
   514 //        srcList.clear();
   515 	    if(cfgSelection == cfgHti){
   515 //	    if(cfgSelection == cfgHti){
   516 	    srcList <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority"
   516 //	    srcList <<"CommPlugin" <<"MaxMsgSize" <<"MaxQueueSize" <<"MaxHeapSize"<<"Priority"
   517 	            <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog"
   517 //	            <<"ShowConsole"<<"MaxWaitTime"<<"StartUpDelay"<<"EnableHtiWatchDog"
   518 	            <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay";
   518 //	            <<"EnableHtiAutoStart"<<"ShowErrorDialogs"<<"ReconnectDelay";
   519 	    }
   519 //	    }
   520 	    else if(cfgSelection == cfgBtComm){
   520 //	    else if(cfgSelection == cfgBtComm){
   521 	        srcList <<"BtDeviceName" <<"BtDeviceName";
   521 //	        srcList <<"BtDeviceName" <<"BtDeviceName";
   522 	    }
   522 //	    }
   523 	    else if(cfgSelection == cfgSerialComm){
   523 //	    else if(cfgSelection == cfgSerialComm){
   524             srcList <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake";
   524 //            srcList <<"CommPort" <<"DataRate"<<"Parity"<<"DataBits"<<"StopBits"<<"SendDelay"<<"Handshake";
   525 	    }
   525 //	    }
   526 	    else{
   526 //	    else{
   527 	    srcList <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout";
   527 //	    srcList <<"IAPName"<<"LocalPort"<<"RemoteHost"<<"RemotePort"<<"ConnectTimeout";
   528 	    }
   528 //	    }
   529 	    
   529 //	    
   530 	    selection = HbListDialog::getStringItems("Select a parameter name in" + cfgSelection, srcList, 0, &ok, HbAbstractItemView::SingleSelection);
   530 //	    selection = HbListDialog::getStringItems("Select a parameter name in" + cfgSelection, srcList, 0, &ok, HbAbstractItemView::SingleSelection);
   531 	}
   531 //	}
   532     
   532 //    
   533     if(ok){
   533 //    if(ok){
   534         name = selection[0];
   534 //        name = selection[0];
   535         value = HbInputDialog::getText("Value for paramater " + name, "", &ok);
   535 //        value = HbInputDialog::getText("Value for paramater " + name, "", &ok);
   536     }
   536 //    }
   537     
   537 //    
   538     if(ok){
   538 //    if(ok){
   539        if(cfgSelection == cfgHti){
   539 //       if(cfgSelection == cfgHti){
   540             mEngineWrapper.setHtiCfgParam(name, value);
   540 //            mEngineWrapper.setHtiCfgParam(name, value);
   541         }
   541 //        }
   542         else if(cfgSelection == cfgBtComm){
   542 //        else if(cfgSelection == cfgBtComm){
   543             mEngineWrapper.setBtCfgParam(name, value);
   543 //            mEngineWrapper.setBtCfgParam(name, value);
   544         }
   544 //        }
   545         else if(cfgSelection == cfgSerialComm){
   545 //        else if(cfgSelection == cfgSerialComm){
   546             mEngineWrapper.setSerialCfgParam(name, value);
   546 //            mEngineWrapper.setSerialCfgParam(name, value);
   547         }
   547 //        }
   548         else{
   548 //        else{
   549             mEngineWrapper.setIPCfgParam(name, value);
   549 //            mEngineWrapper.setIPCfgParam(name, value);
   550         }   
   550 //        }   
   551     }
   551 //    }
   552 }
   552 }
   553 
   553 
   554 
   554