[PC-BSD Commits] r15151 - in pcbsd/current: src-qt4 src-qt4/pc-bluetoothmanager src-qt4/pc-bluetoothtray system-overlay/usr/local/etc system-overlay/usr/local/share/pcbsd/xstartup

svn at pcbsd.org svn at pcbsd.org
Fri Feb 10 04:21:32 PST 2012


Author: kenmoore
Date: 2012-02-10 12:21:32 +0000 (Fri, 10 Feb 2012)
New Revision: 15151

Added:
   pcbsd/current/src-qt4/pc-bluetoothtray/
   pcbsd/current/src-qt4/pc-bluetoothtray/activeBluetooth.png
   pcbsd/current/src-qt4/pc-bluetoothtray/btTray.cpp
   pcbsd/current/src-qt4/pc-bluetoothtray/btTray.h
   pcbsd/current/src-qt4/pc-bluetoothtray/inactiveBluetooth.png
   pcbsd/current/src-qt4/pc-bluetoothtray/main.cpp
   pcbsd/current/src-qt4/pc-bluetoothtray/pc-bluetoothtray.pro
   pcbsd/current/src-qt4/pc-bluetoothtray/pc-bluetoothtray.qrc
   pcbsd/current/system-overlay/usr/local/share/pcbsd/xstartup/bluetooth-tray.sh
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
   pcbsd/current/src-qt4/pc-bluetoothmanager/main.cpp
   pcbsd/current/src-qt4/pc-bluetoothmanager/pc-bluetoothmanager.pro
   pcbsd/current/system-overlay/usr/local/etc/sudoers
Log:
Add pc-bluetoothTray application, update pc-bluetoothmanager, and add startup script to check whether to start the bluetooth tray



Modified: pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.cpp	2012-02-10 11:34:35 UTC (rev 15150)
+++ pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.cpp	2012-02-10 12:21:32 UTC (rev 15151)
@@ -6,7 +6,7 @@
 #include <QMessageBox>
 
 /* UI handles
- * Comp settings Tab: pushChangeCompName  pushDisconnectDevice  pushRestart  lineCompName  listConnectedDevices
+ * Comp settings Tab: pushStartTray   pushChangeCompName  pushDisconnectDevice  pushRestart  lineCompName  listConnectedDevices
  * New Device Tab:  pushAddDevice  pushScanNew  listNewDevice  newDeviceInfo
  * Old Device Tab:  pushConfigureOld  pushRemoveOld  listOldDevice oldDeviceInfo pushConnectDevice
  */
@@ -40,8 +40,7 @@
   connect(ui->pushConnectDevice,SIGNAL(clicked()),this,SLOT(connectDevice()));
   connect(ui->pushRestart,SIGNAL(clicked()),this,SLOT(restartBluetooth()));
   connect(ui->pushChangeCompName,SIGNAL(clicked()),this,SLOT(changeCompName()));
-  //Setup GUI enables/disables
-  
+  connect(ui->pushStartTray,SIGNAL(clicked()),this,SLOT(startTrayApplication()));
   //Start on the system settings tab
   ui->tabWidget->setCurrentIndex(0);
   //Load the information for each Tab as needed
@@ -380,3 +379,19 @@
   updateCompInfo();
   
 }
+
+void btmaingui::slotSingleInstance()
+{
+  
+  this->showNormal();
+  this->activateWindow();
+  this->raise();
+  //this->show();
+}
+
+void btmaingui::startTrayApplication(){
+  //Startup pc-bluetoothtray with sudo
+  QString cmd = "sudo pc-bluetoothtray &";
+  Utils::runShellCommand(cmd);
+}
+

Modified: pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.h
===================================================================
--- pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.h	2012-02-10 11:34:35 UTC (rev 15150)
+++ pcbsd/current/src-qt4/pc-bluetoothmanager/btmaingui.h	2012-02-10 12:21:32 UTC (rev 15151)
@@ -16,10 +16,10 @@
 public:
     explicit btmaingui(QWidget *parent = 0);
     ~btmaingui();
-
+    void firstRun();
+    
 private:
     Ui::btmaingui *ui;
-    void firstRun();
     bool rootPermissions();
     void refreshGUI();  
     
@@ -38,6 +38,8 @@
     void connectDevice();
     void restartBluetooth();
     void changeCompName();
+    void slotSingleInstance();
+    void startTrayApplication();
 };
 
 #endif // BTMAINGUI_H

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

Modified: pcbsd/current/src-qt4/pc-bluetoothmanager/main.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-bluetoothmanager/main.cpp	2012-02-10 11:34:35 UTC (rev 15150)
+++ pcbsd/current/src-qt4/pc-bluetoothmanager/main.cpp	2012-02-10 12:21:32 UTC (rev 15151)
@@ -1,11 +1,37 @@
-#include <QtGui/QApplication>
+
+#include <qtranslator.h>
+#include <qtextcodec.h>
+#include <qlocale.h>
+#include <QDebug>
+#include <QFile>
+#include <QSystemTrayIcon>
+#include <QApplication>
+#include <QMessageBox>
+#include <QtGui>
+#include <qtsingleapplication.h>
+
 #include "btmaingui.h"
+#include "../config.h"
 
-int main(int argc, char *argv[])
+int  main(int argc, char ** argv)
 {
-    QApplication a(argc, argv);
-    btmaingui w;
-    w.show();
+   QtSingleApplication a(argc, argv);
+   if ( a.isRunning() )
+     return !(a.sendMessage("show"));
 
-    return a.exec();
+   QTranslator translator;
+   QLocale mylocale;
+   QString langCode = mylocale.name();
+   if ( ! QFile::exists(PREFIX + "/share/pcbsd/i18n/pc-bluetoothmanager_" + langCode + ".qm" ) )  langCode.truncate(langCode.indexOf("_"));
+   translator.load( QString("pc-bluetoothmanager_") + langCode, PREFIX + "/share/pcbsd/i18n/" );
+   a.installTranslator( &translator );
+   qDebug() << "Locale:" << langCode;
+   btmaingui tray;
+   QApplication::setQuitOnLastWindowClosed(false);
+
+   // Init our program
+   QObject::connect(&a, SIGNAL(messageReceived(const QString&)), &tray, SLOT(slotSingleInstance()) );
+
+   tray.firstRun();
+   return  a.exec();
 }

Modified: pcbsd/current/src-qt4/pc-bluetoothmanager/pc-bluetoothmanager.pro
===================================================================
--- pcbsd/current/src-qt4/pc-bluetoothmanager/pc-bluetoothmanager.pro	2012-02-10 11:34:35 UTC (rev 15150)
+++ pcbsd/current/src-qt4/pc-bluetoothmanager/pc-bluetoothmanager.pro	2012-02-10 12:21:32 UTC (rev 15151)
@@ -7,9 +7,10 @@
 QT       += core gui
 
 TARGET = pc-bluetoothmanager
+DESTDIR = /usr/local/bin/
 TEMPLATE = app
+LANGUAGE = C++
 
-
 SOURCES += main.cpp\
         btmaingui.cpp
 
@@ -17,4 +18,8 @@
 
 FORMS    += btmaingui.ui
 
-LIBS     += -lpcbsd
+LIBS     += -lpcbsd -lQtSolutions_SingleApplication-head
+
+#RESOURCES += pc-bluetoothmanager.qrc
+
+INCLUDEPATH += /usr/local/include
\ No newline at end of file

Index: pcbsd/current/src-qt4/pc-bluetoothtray/activeBluetooth.png
===================================================================
--- pcbsd/current/src-qt4/pc-bluetoothtray/activeBluetooth.png	2012-02-10 11:34:35 UTC (rev 15150)
+++ pcbsd/current/src-qt4/pc-bluetoothtray/activeBluetooth.png	2012-02-10 12:21:32 UTC (rev 15151)

Property changes on: pcbsd/current/src-qt4/pc-bluetoothtray/activeBluetooth.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
Index: pcbsd/current/src-qt4/pc-bluetoothtray/inactiveBluetooth.png
===================================================================
--- pcbsd/current/src-qt4/pc-bluetoothtray/inactiveBluetooth.png	2012-02-10 11:34:35 UTC (rev 15150)
+++ pcbsd/current/src-qt4/pc-bluetoothtray/inactiveBluetooth.png	2012-02-10 12:21:32 UTC (rev 15151)

Property changes on: pcbsd/current/src-qt4/pc-bluetoothtray/inactiveBluetooth.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+image/png
Modified: pcbsd/current/system-overlay/usr/local/etc/sudoers
===================================================================
--- pcbsd/current/system-overlay/usr/local/etc/sudoers	2012-02-10 11:34:35 UTC (rev 15150)
+++ pcbsd/current/system-overlay/usr/local/etc/sudoers	2012-02-10 12:21:32 UTC (rev 15151)
@@ -106,3 +106,4 @@
 %wheel ALL = NOPASSWD: /usr/local/bin/pc-fbsdupdatecheck
 %wheel ALL = NOPASSWD: /usr/local/bin/life-preserver
 %wheel ALL = NOPASSWD: /usr/local/etc/amount/amount
+%wheel ALL = NOPASSWD: /usr/local/bin/pc-bluetoothtray



More information about the Commits mailing list