Changeset 9398839


Ignore:
Timestamp:
12/05/14 10:13:07 (8 weeks ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.1.1
Children:
fc461ca
Parents:
3667cdb
Message:

Convert over libpcbsd to Qt5.
Also add a new SingleApplication? class to the UI library.
To Use:
1) LIBS += -lpcbsd-ui in the *.pro file
In main.cpp
2A) #include <pcbsd-SingleApplication?.h>
2B) To use, only two major differences between old QSingleApplication
PCSingleApplication app(argc,argv);
if(!app.isPrimaryProcess()){ return 0; }
2C) connect(app, SIGNAL(InputsAvailable?(QStringList)), <window>, <slot>)

Location:
src-qt5/libpcbsd
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • src-qt5/libpcbsd/ui/dialogwpaenterprise.cpp

    r3667cdb r9398839  
    1919     
    2020    if ( radioEAPTLS->isChecked() ) { 
    21         textClientCert->setHidden(FALSE); 
    22         lineClientCert->setHidden(FALSE); 
    23         pushSelectClientCert->setHidden(FALSE); 
    24         textPrivateKeyFile->setHidden(FALSE); 
    25         linePrivateKeyFile->setHidden(FALSE); 
    26         pushSelectPrivateKeyFile->setHidden(FALSE);      
     21        textClientCert->setHidden(false); 
     22        lineClientCert->setHidden(false); 
     23        pushSelectClientCert->setHidden(false); 
     24        textPrivateKeyFile->setHidden(false); 
     25        linePrivateKeyFile->setHidden(false); 
     26        pushSelectPrivateKeyFile->setHidden(false);      
    2727    } 
    2828     
    2929    if ( radioEAPTTLS->isChecked() ) { 
    30         textClientCert->setHidden(TRUE); 
    31         lineClientCert->setHidden(TRUE); 
    32         pushSelectClientCert->setHidden(TRUE); 
    33         textPrivateKeyFile->setHidden(TRUE); 
    34         linePrivateKeyFile->setHidden(TRUE); 
    35         pushSelectPrivateKeyFile->setHidden(TRUE);       
     30        textClientCert->setHidden(true); 
     31        lineClientCert->setHidden(true); 
     32        pushSelectClientCert->setHidden(true); 
     33        textPrivateKeyFile->setHidden(true); 
     34        linePrivateKeyFile->setHidden(true); 
     35        pushSelectPrivateKeyFile->setHidden(true);       
    3636    } 
    3737     
    3838    if ( radioEAPPEAP->isChecked() ) { 
    39         textClientCert->setHidden(TRUE); 
    40         lineClientCert->setHidden(TRUE); 
    41         pushSelectClientCert->setHidden(TRUE); 
    42         textPrivateKeyFile->setHidden(TRUE); 
    43         linePrivateKeyFile->setHidden(TRUE); 
    44         pushSelectPrivateKeyFile->setHidden(TRUE); 
     39        textClientCert->setHidden(true); 
     40        lineClientCert->setHidden(true); 
     41        pushSelectClientCert->setHidden(true); 
     42        textPrivateKeyFile->setHidden(true); 
     43        linePrivateKeyFile->setHidden(true); 
     44        pushSelectPrivateKeyFile->setHidden(true); 
    4545    } 
    4646 
     
    119119    if ( type == 1) 
    120120    { 
    121         radioEAPTLS->setChecked(TRUE); 
     121        radioEAPTLS->setChecked(true); 
    122122    } else if (type == 2) { 
    123         radioEAPTTLS->setChecked(TRUE); 
     123        radioEAPTTLS->setChecked(true); 
    124124    } else if (type == 3) { 
    125         radioEAPPEAP->setChecked(TRUE); 
     125        radioEAPPEAP->setChecked(true); 
    126126    } 
    127127 
  • src-qt5/libpcbsd/ui/pcbsd-ui.h

    r3667cdb r9398839  
    2626#define PCBSDUI_H 
    2727 
    28 #include <QtGui/QApplication> 
    29 #include <qtsingleapplication.h> 
     28#include <QApplication> 
    3029#include <QStringList> 
    3130#include <QTreeWidgetItem> 
     
    5150} 
    5251 
     52//== Old Qt4 Code == 
     53/* 
    5354class PCApplication: public QApplication 
    5455{ 
     
    8081    virtual bool onSecondInstance(QStringList args) {(void)args;return true;} 
    8182 
    82 }; 
     83};*/ 
    8384 
    8485class dialogWPAEnterprise; 
  • src-qt5/libpcbsd/ui/ui.cpp

    r3667cdb r9398839  
    2222  //Create the dialog 
    2323  QDialog *inputDialog = new QDialog; 
    24   inputDialog->setModal(TRUE); 
     24  inputDialog->setModal(true); 
    2525  inputDialog->setWindowTitle(title); 
    2626  //Add a label and editbox for each row (one per input in list) 
     
    182182} 
    183183 
    184  
     184//=== Old Qt4 Code === 
     185/* 
    185186/////////////////////////////////////////////////////////////////////////////// 
    186187static bool initTranslator(QTranslator& translator, QString appname) 
     
    197198    return true; 
    198199} 
     200 
    199201 
    200202/////////////////////////////////////////////////////////////////////////////// 
     
    271273    } 
    272274    return false; 
    273 } 
     275}*/ 
  • src-qt5/libpcbsd/ui/ui.pro

    r3667cdb r9398839  
    11 
    2 QT       += core gui network 
     2QT       += core gui network widgets 
    33 
    4 LIBS +=-L../ -L/usr/local/lib -lpcbsd-utils -lQtSolutions_SingleApplication-head 
     4LIBS +=-L../ -L/usr/local/lib -lpcbsd-utils 
    55INCLUDEPATH     += ../utils/ /usr/local/include 
    66 
     
    2222    kboptionswidget.h \ 
    2323    kblayoutsetupwidget.h \ 
    24     kblayoutselectdialog.h 
     24    kblayoutselectdialog.h \ 
     25    pcbsd-SingleApplication.h 
    2526 
    2627SOURCES += dialogInfoBox.cpp \ 
     
    3334    kboptionswidget.cpp \ 
    3435    kblayoutsetupwidget.cpp \ 
    35     kblayoutselectdialog.cpp 
     36    kblayoutselectdialog.cpp \ 
     37    SingleApplication.cpp 
    3638 
    3739RESOURCES += libpcbsd-ui.qrc 
     
    114116 
    115117dotrans.path=/usr/local/share/pcbsd/i18n/ 
    116 dotrans.extra=cd i18n && lrelease-qt4 -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)/usr/local/share/pcbsd/i18n/ 
     118dotrans.extra=cd i18n && /usr/local/lib/qt5/bin/lrelease -nounfinished *.ts && cp *.qm $(INSTALL_ROOT)/usr/local/share/pcbsd/i18n/ 
    117119 
    118120include.path=/usr/local/include/ 
     
    121123INSTALLS += target include dotrans 
    122124 
    123 QMAKE_LIBDIR = /usr/local/lib/qt4 /usr/local/lib 
     125QMAKE_LIBDIR = /usr/local/lib/qt5 /usr/local/lib 
  • src-qt5/libpcbsd/utils/hardware.cpp

    r3667cdb r9398839  
    262262    name = name.simplified(); //remove extra white space 
    263263    if(name.isEmpty() && tryagain){ 
    264       name = getBTRemoteName(bdaddr,FALSE); //try one more time, false to avoid loop situation 
     264      name = getBTRemoteName(bdaddr,false); //try one more time, false to avoid loop situation 
    265265    } 
    266266    return name; 
  • src-qt5/libpcbsd/utils/netif.cpp

    r3667cdb r9398839  
    7878   memset(&ifr, 0, sizeof(struct ifreq)); 
    7979 
    80    strncpy(ifr.ifr_name, name.toAscii(), IFNAMSIZ); 
     80   strncpy(ifr.ifr_name, name.toLocal8Bit(), IFNAMSIZ); 
    8181   int s = socket(PF_INET, SOCK_DGRAM, 0); 
    8282    
     
    9292   memset(&ifr, 0, sizeof(struct ifreq)); 
    9393 
    94    strncpy(ifr.ifr_name, name.toAscii(), IFNAMSIZ); 
     94   strncpy(ifr.ifr_name, name.toLocal8Bit(), IFNAMSIZ); 
    9595   int s = socket(PF_INET, SOCK_DGRAM, 0); 
    9696    
     
    114114   mib[3] = AF_LINK; 
    115115   mib[4] = NET_RT_IFLIST; 
    116    mib[5] = if_nametoindex(name.toAscii()); 
     116   mib[5] = if_nametoindex(name.toLocal8Bit()); 
    117117 
    118118   //First find the size of the return, so we can adjust buf accordingly 
     
    139139   memset(&ifm, 0, sizeof(struct ifmediareq)); 
    140140 
    141    strncpy(ifm.ifm_name, name.toAscii(), IFNAMSIZ); 
     141   strncpy(ifm.ifm_name, name.toLocal8Bit(), IFNAMSIZ); 
    142142   int s = socket(AF_INET, SOCK_DGRAM, 0); 
    143143 
     
    181181   memset(&ifm, 0, sizeof(struct ifmediareq)); 
    182182 
    183    strncpy(ifm.ifm_name, name.toAscii(), IFNAMSIZ); 
     183   strncpy(ifm.ifm_name, name.toLocal8Bit(), IFNAMSIZ); 
    184184   int s = socket(AF_INET, SOCK_DGRAM, 0); 
    185185 
     
    194194   memset(&ifr, 0, sizeof(struct ifreq)); 
    195195 
    196    strncpy(ifr.ifr_name, name.toAscii(), IFNAMSIZ); 
     196   strncpy(ifr.ifr_name, name.toLocal8Bit(), IFNAMSIZ); 
    197197   int s = socket(AF_INET, SOCK_DGRAM, 0); 
    198198 
     
    214214   mib[3] = AF_LINK; 
    215215   mib[4] = NET_RT_IFLIST; 
    216    mib[5] = if_nametoindex(name.toAscii()); 
     216   mib[5] = if_nametoindex(name.toLocal8Bit()); 
    217217 
    218218   //First find the size of the return, so we can adjust buf accordingly 
     
    238238   mib[3] = AF_LINK; 
    239239   mib[4] = NET_RT_IFLIST; 
    240    mib[5] = if_nametoindex(name.toAscii()); 
     240   mib[5] = if_nametoindex(name.toLocal8Bit()); 
    241241 
    242242   //First find the size of the return, so we can adjust buf accordingly 
     
    262262   mib[3] = AF_LINK; 
    263263   mib[4] = NET_RT_IFLIST; 
    264    mib[5] = if_nametoindex(name.toAscii()); 
     264   mib[5] = if_nametoindex(name.toLocal8Bit()); 
    265265 
    266266   //First find the size of the return, so we can adjust buf accordingly 
     
    286286   mib[3] = AF_LINK; 
    287287   mib[4] = NET_RT_IFLIST; 
    288    mib[5] = if_nametoindex(name.toAscii()); 
     288   mib[5] = if_nametoindex(name.toLocal8Bit()); 
    289289 
    290290   //First find the size of the return, so we can adjust buf accordingly 
  • src-qt5/libpcbsd/utils/pcbsd-hardware.h

    r3667cdb r9398839  
    4040   static void restartBT(); 
    4141   static QStringList findBTdevices(); 
    42    static QString getBTRemoteName(QString bdaddr, bool tryagain = TRUE); 
     42   static QString getBTRemoteName(QString bdaddr, bool tryagain = true); 
    4343   static QStringList readAllSavedBTDevices(); 
    4444   static QStringList readSavedBTDevice(QString bdaddr); 
  • src-qt5/libpcbsd/utils/utils.cpp

    r3667cdb r9398839  
    3232#include <QTextStream> 
    3333#include <QProcess> 
    34 #include <QApplication> 
     34#include <QCoreApplication> 
    3535#include <QDebug> 
    3636 
     
    7171   char result[1000]; 
    7272   size_t len = sizeof(result); 
    73    sysctlbyname(sysctl.toAscii(), result, &len, NULL, 0); 
     73   sysctlbyname(sysctl.toLocal8Bit(), result, &len, NULL, 0); 
    7474   result[len] = '\0'; 
    7575   return QString(result); 
     
    8080   long long result = 0; 
    8181   size_t len = sizeof(result); 
    82    sysctlbyname(sysctl.toAscii(), &result, &len, NULL, 0); 
     82   sysctlbyname(sysctl.toLocal8Bit(), &result, &len, NULL, 0); 
    8383   return result; 
    8484} 
     
    814814  } 
    815815     
    816   return TRUE; 
     816  return true; 
    817817} 
    818818 
  • src-qt5/libpcbsd/utils/utils.pro

    r3667cdb r9398839  
    11 
    2 QT       += core network 
     2QT       += core network widgets 
    33 
    44TARGET=pcbsd-utils 
     
    3434INSTALLS += target include  
    3535 
    36 QMAKE_LIBDIR = /usr/local/lib/qt4 /usr/local/lib 
     36QMAKE_LIBDIR = /usr/local/lib/qt5 /usr/local/lib 
Note: See TracChangeset for help on using the changeset viewer.