[PC-BSD Commits] r15053 - pcbsd/current/src-qt4/pc-bluetoothmanager

svn at pcbsd.org svn at pcbsd.org
Tue Jan 24 11:47:32 PST 2012


Author: kenmoore
Date: 2012-01-24 19:47:32 +0000 (Tue, 24 Jan 2012)
New Revision: 15053

Modified:
   pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.cpp
   pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.h
   pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.ui
Log:
Start adding some functionality to the bluetooth GUI



Modified: pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.cpp	2012-01-24 18:54:30 UTC (rev 15052)
+++ pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.cpp	2012-01-24 19:47:32 UTC (rev 15053)
@@ -1,14 +1,84 @@
 #include "btmaingui.h"
 #include "ui_btmaingui.h"
+#include <pcbsd-hardware.h>
+#include <pcbsd-utils.h>
+#include <QDebug>
 
+/* UI handles
+ * Comp settings Tab: checkIsDiscoverable  pushChangeSettings  settingsInfo  pushRestart
+ * New Device Tab:  pushAddDevice  pushScanNew  listNewDevice  newDeviceInfo
+ * Old Device Tab:  pushConfigureOld  pushRemoveOld  listOldDevice oldDeviceInfo
+ */
+
 btmaingui::btmaingui(QWidget *parent) :
     QMainWindow(parent),
     ui(new Ui::btmaingui)
 {
     ui->setupUi(this);
+    firstRun();
 }
 
 btmaingui::~btmaingui()
 {
     delete ui;
 }
+
+void btmaingui::firstRun(){
+  //Setup Signals/Slots
+  connect(ui->pushScanNew,SIGNAL(clicked()),this,SLOT(scanForDevices()));
+  connect(ui->tabWidget,SIGNAL(currentChanged(int)),this,SLOT(tabChanged(int)));
+  //Setup GUI enables/disables
+  
+  //Start on the system settings tab
+  ui->tabWidget->setCurrentIndex(0);
+}
+
+void btmaingui::tabChanged(int newTab){
+  if(newTab==0){  //Computer Settings
+    updateCompInfo();
+  }else if(newTab==1){  //New Device Tab
+    scanForDevices();
+  }else if(newTab==2){  //Old Device Tab
+      
+  }else{
+    qDebug() << "BlueToothManager: TabChanged Error: Tab #"<< newTab << " does not exist";
+  }
+}
+
+void btmaingui::scanForDevices(){
+   //Clear the GUI for new results
+   ui->newDeviceInfo->clear();
+   ui->newDeviceInfo->append(tr("Searching for discoverable Bluetooth devices"));
+   ui->listNewDevice->clear();
+   //Start scanning and put the results in the listbox
+   QStringList bdaddrList = Hardware::findBTdevices();
+   QStringList connectionList = Utils::runShellCommand("hccontrol read_connection_list");
+   for(int i=0; i<bdaddrList.length(); i++){
+     if( !connectionList.contains(bdaddrList[i]) ){ //Check if it is a new device (not connected)
+       QString name = Hardware::getBTRemoteName(bdaddrList[i]);
+       ui->listNewDevice->addItem(name+" ("+bdaddrList[i]+")"); //Add it to the new device list
+     }
+   }
+   
+}
+
+void btmaingui::refreshOldDeviceList(){
+  
+}
+
+void btmaingui::addNewDevice(){
+  
+}
+
+void btmaingui::updateCompInfo(){
+  
+}
+
+void btmaingui::updateNewDeviceInfo(){
+  
+}
+
+void btmaingui::updateOldDeviceInfo(){
+  
+}
+

Modified: pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.h
===================================================================
--- pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.h	2012-01-24 18:54:30 UTC (rev 15052)
+++ pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.h	2012-01-24 19:47:32 UTC (rev 15053)
@@ -2,6 +2,8 @@
 #define BTMAINGUI_H
 
 #include <QMainWindow>
+#include <pcbsd-hardware.h>
+#include <pcbsd-utils.h>
 
 namespace Ui {
     class btmaingui;
@@ -17,6 +19,17 @@
 
 private:
     Ui::btmaingui *ui;
+    void firstRun();
+    
+private slots:
+    void scanForDevices();
+    void tabChanged(int);
+    void refreshOldDeviceList();
+    void addNewDevice();
+    void updateCompInfo();
+    void updateNewDeviceInfo();
+    void updateOldDeviceInfo();
+  
 };
 
 #endif // BTMAINGUI_H

Modified: pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.ui
===================================================================
(Binary files differ)



More information about the Commits mailing list