Changeset 6169 for trunk/qt-gui

Show
Ignore:
Timestamp:
04/23/08 04:30:09 (7 months ago)
Author:
flynd
Message:

Moved plugin name, config path and name of config file to gui-defines.h.

Location:
trunk/qt-gui/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt-gui/src/gui-defines.h

    r5944 r6169  
    2121#define GUIDEFINES_H 
    2222 
     23#ifdef USE_KDE 
     24# define PLUGIN_NAME "kde-gui" 
     25#else 
     26# define PLUGIN_NAME "qt-gui" 
     27#endif 
     28 
    2329#define QTGUI_DIR "qt-gui/" 
    2430#define EMOTICONS_DIR "emoticons/" 
     31#define QTGUI_CONFIGFILE "licq_qt-gui.conf" 
    2532 
    2633#define NUM_MSG_PER_HISTORY 40 
  • trunk/qt-gui/src/licqgui.cpp

    r5943 r6169  
    3636#include <unistd.h> // for getopt 
    3737 
     38#include "gui-defines.h" 
    3839#include "mainwin.h" 
    3940#include "sigman.h" 
     
    4849const char *LP_Usage(void) 
    4950{ 
    50 #ifdef USE_KDE 
    51   static const char usage[] = 
    52     "Usage:  Licq [options] -p kde-gui -- [-h] [-s skinname] [-i iconpack] [-e extendediconpack] [-g gui style]\n" 
    53     " -h : this help screen\n" 
    54     " -s : set the skin to use (must be in {base dir}/qt-gui/skin.skinname)\n" 
    55     " -i : set the icons to use (must be in {base dir}/qt-gui/icons.iconpack)\n" 
    56     " -e : set the extended icons to use (must be in [base dir]/qt-gui/extended.icons.iconpack)\n" 
    57     " -g : set the gui style (MOTIF / WINDOWS / MAC / CDE / GTK / SGI / LCD), ignored by KDE support\n" 
    58     " -d : start hidden (dock icon only)\n" 
    59     " -D : disable dock icon for this session (does not affect dock icon settings)"; 
    60 #else 
    61   static const char usage[] = 
    62     "Usage:  Licq [options] -p qt-gui -- [-h] [-s skinname] [-i iconpack] [-e extendediconpack] [-g gui style]\n" 
    63     " -h : this help screen\n" 
    64     " -s : set the skin to use (must be in {base dir}/qt-gui/skin.skinname)\n" 
    65     " -i : set the icons to use (must be in {base dir}/qt-gui/icons.iconpack)\n" 
    66     " -e : set the extended icons to use (must be in [base dir]/qt-gui/extended.icons.iconpack)\n" 
    67     " -g : set the gui style (MOTIF / WINDOWS / MAC / CDE / GTK / SGI / LCD), ignored by KDE support\n" 
    68     " -d : start hidden (dock icon only)\n" 
    69     " -D : disable dock icon for this session (does not affect dock icon settings)"; 
    70 #endif 
    71  
    72   return usage; 
     51  static const QString usage = QString( 
     52      "Usage:  Licq [options] -p %1 -- [-h] [-s skinname] [-i iconpack] [-e extendediconpack]" 
     53#ifndef USE_KDE 
     54      " [-g gui style]" 
     55#endif 
     56      "\n" 
     57      " -h : this help screen\n" 
     58      " -s : set the skin to use (must be in %2%3skin.skinname)\n" 
     59      " -i : set the icons to use (must be in %4%5icons.iconpack)\n" 
     60      " -e : set the extended icons to use (must be in %6%7extended.icons.iconpack)\n" 
     61#ifndef USE_KDE 
     62      " -g : set the gui style (%8 or 'default' to follow global Qt settings)\n" 
     63#endif 
     64      " -d : start hidden (dock icon only)\n" 
     65      " -D : disable dock icon for this session (does not affect dock icon settings)" 
     66      ) 
     67      .arg(PLUGIN_NAME) 
     68      .arg(BASE_DIR) 
     69      .arg(QTGUI_DIR) 
     70      .arg(BASE_DIR) 
     71      .arg(QTGUI_DIR) 
     72      .arg(BASE_DIR) 
     73      .arg(QTGUI_DIR) 
     74#ifndef USE_KDE 
     75      .arg(QStyleFactory::keys().join(", ")) 
     76#endif 
     77      ; 
     78 
     79  return usage.latin1(); 
    7380} 
    7481 
     
    8693const char *LP_ConfigFile(void) 
    8794{ 
    88   return "licq_qt-gui.conf"; 
     95  return QTGUI_CONFIGFILE; 
    8996} 
    9097 
     
    216223  char iconsName[32] = ""; 
    217224  char extendedIconsName[32] = ""; 
     225#ifndef USE_KDE 
    218226  char styleName[32] = ""; 
     227#endif 
    219228  bool bStartHidden = false; 
    220229 
     
    226235  cmdLineParams += QString(argv[0]); 
    227236  cmdLineParams += QString("-p"); 
    228 #ifdef USE_KDE 
    229   cmdLineParams += QString("kde-gui"); 
    230 #else 
    231   cmdLineParams += QString("qt-gui"); 
    232 #endif 
     237  cmdLineParams += QString(PLUGIN_NAME); 
    233238  cmdLineParams += QString("--"); 
    234239  for(int i=1;i<argc;i++) 
     
    256261      extendedIconsName[sizeof(extendedIconsName) - 1] = '\0'; 
    257262      break; 
     263#ifndef USE_KDE 
    258264    case 'g': // gui style 
    259265      strncpy(styleName, optarg, sizeof(styleName)); 
    260266      styleName[sizeof(styleName) - 1] = '\0'; 
    261267      break; 
     268#endif 
    262269    case 'd': // dock icon 
    263270      if (!m_bDisableDockIcon) 
     
    310317  gLog.Info("%sAttempting to load %s Qt-GUI translation.\n", L_INITxSTR, 
    311318            GetLocale()); 
    312   QString str; 
    313   str.sprintf("%sqt-gui/locale/%s", SHARE_DIR, GetLocale()); 
    314319  QTranslator *trans = new QTranslator(this); 
    315   trans->load(str); 
     320  trans->load(QString("%1" QTGUI_DIR "locale/%2").arg(SHARE_DIR).arg(GetLocale())); 
    316321  installTranslator(trans); 
    317322} 
  • trunk/qt-gui/src/mainwin.cpp

    r5779 r6169  
    380380  gLog.Info("%sQt GUI configuration.\n", L_INITxSTR); 
    381381#endif 
    382   snprintf(szTemp, MAX_FILENAME_LEN, "%s/licq_qt-gui.conf", BASE_DIR); 
     382  snprintf(szTemp, MAX_FILENAME_LEN, "%s/" QTGUI_CONFIGFILE , BASE_DIR); 
    383383  szTemp[MAX_FILENAME_LEN - 1] = '\0'; 
    384384  CIniFile licqConf; 
     
    11951195    // save window position and size 
    11961196    char buf[MAX_FILENAME_LEN]; 
    1197     snprintf(buf, MAX_FILENAME_LEN, "%s/licq_qt-gui.conf", BASE_DIR); 
     1197    snprintf(buf, MAX_FILENAME_LEN, "%s/" QTGUI_CONFIGFILE, BASE_DIR); 
    11981198    buf[MAX_FILENAME_LEN - 1] = '\0'; 
    11991199    CIniFile licqConf(INI_FxALLOWxCREATE | INI_FxWARN); 
     
    34273427  // Save all our options 
    34283428  char filename[MAX_FILENAME_LEN]; 
    3429   snprintf(filename, MAX_FILENAME_LEN, "%s/licq_qt-gui.conf", BASE_DIR); 
     3429  snprintf(filename, MAX_FILENAME_LEN, "%s/" QTGUI_CONFIGFILE, BASE_DIR); 
    34303430  filename[MAX_FILENAME_LEN - 1] = '\0'; 
    34313431  CIniFile licqConf(INI_FxERROR | INI_FxALLOWxCREATE); 
  • trunk/qt-gui/src/skinbrowser.cpp

    r5514 r6169  
    3333#include "editfile.h" 
    3434#include "ewidgets.h" 
     35#include "gui-defines.h" 
    3536#include "licq_log.h" 
    3637#include "licq_constants.h" 
     
    177178    if (!dSkins.count() && !dSkinsUser.count()) 
    178179    { 
    179         gLog.Error("%sError reading qt-gui directory %s.\n", L_ERRORxSTR, szDir.latin1()); 
     180        gLog.Error("%sError reading " PLUGIN_NAME " directory %s.\n", L_ERRORxSTR, szDir.latin1()); 
    180181        cmbSkin->insertItem(tr("Error")); 
    181182        cmbSkin->setEnabled(false); 
     
    214215    if (!dIcons.count() && !dIconsUser.count()) 
    215216    { 
    216         gLog.Error("%sError reading qt-gui directory %s.\n", L_ERRORxSTR, szDir.latin1()); 
     217        gLog.Error("%sError reading " PLUGIN_NAME " directory %s.\n", L_ERRORxSTR, szDir.latin1()); 
    217218        cmbIcon->insertItem(tr("Error")); 
    218219        cmbIcon->setEnabled(false); 
     
    279280    if (!dExtendedIcons.count() && !dExtendedIconsUser.count()) 
    280281    { 
    281         gLog.Error("%sError reading qt-gui directory %s.\n", L_ERRORxSTR, szDir.latin1()); 
     282        gLog.Error("%sError reading " PLUGIN_NAME " directory %s.\n", L_ERRORxSTR, szDir.latin1()); 
    282283        cmbExtIcon->insertItem(tr("Error")); 
    283284        cmbExtIcon->setEnabled(false); 
     
    419420{ 
    420421  if (!cmbSkin->currentText()) return; 
    421   QString f; 
    422   f.sprintf("%s/qt-gui/skin.%s/%s.skin", BASE_DIR, 
    423             QFile::encodeName(cmbSkin->currentText()).data(), 
    424             QFile::encodeName(cmbSkin->currentText()).data()); 
    425   if (!QFile(f).exists()) 
    426     f.sprintf("%sqt-gui/skin.%s/%s.skin", SHARE_DIR, 
    427               QFile::encodeName(cmbSkin->currentText()).data(), 
    428               QFile::encodeName(cmbSkin->currentText()).data()); 
     422  QString skinName = QFile::encodeName(cmbSkin->currentText()); 
     423  QString f = QTGUI_DIR "skin." + skinName + "/" + skinName + ".skin"; 
     424  QString baseF = QString(BASE_DIR) + "/" + f; 
     425  if (QFile(baseF).exists()) 
     426    f = baseF; 
     427  else 
     428    f = SHARE_DIR + f; 
    429429  (void) new EditFileDlg(f); 
    430430}