Changeset 579:a7ac68b7f20e in qutecom-2.2


Ignore:
Timestamp:
Mar 11, 2010 10:05:47 AM (3 years ago)
Author:
laurent@…
Branch:
default
Message:

use 100% adium theme compatible

Location:
wengophone
Files:
483 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • wengophone/resources/config/config.xml

    r566 r579  
    3737 - Added translation.received 
    3838 - Added translation.sent 
     39version 15: 
     40 - chat.theme.variant 
    3941--> 
    4042<config.version><int>14</int></config.version> 
     
    124126<last.chat.history.save.dir><string></string></last.chat.history.save.dir> 
    125127<chat.theme><string>renkoo</string></chat.theme> 
     128<chat.theme.variant><string>renkoo</string></chat.theme.variant> 
    126129 
    127130<linux.prefered.browser><string></string></linux.prefered.browser> 
  • wengophone/src/model/config/Config.cpp

    r558 r579  
    103103 
    104104const string Config::APPEARANCE_CHATTHEME_KEY = "chat.theme"; 
     105const string Config::APPEARANCE_CHATTHEMEVARIANT_KEY = "chat.theme.variant"; 
    105106 
    106107const string Config::LANGUAGE_AUTODETECT_KEYVALUE = "detect"; 
     
    609610} 
    610611 
     612string Config::getChatThemeVariant() const { 
     613        return getStringKeyValue(APPEARANCE_CHATTHEMEVARIANT_KEY); 
     614} 
     615 
    611616string Config::getLanguage() const { 
    612617        return getStringKeyValue(LANGUAGE_KEY); 
  • wengophone/src/model/config/Config.h

    r558 r579  
    414414        static const std::string APPEARANCE_CHATTHEME_KEY; 
    415415        std::string getChatTheme() const; 
     416         
     417        static const std::string APPEARANCE_CHATTHEMEVARIANT_KEY; 
     418        std::string getChatThemeVariant() const; 
    416419        /** @} */ 
    417420 
  • wengophone/src/presentation/qt/chat/QtChatHistoryWidget.cpp

    r567 r579  
    5252        setContextMenuPolicy(Qt::NoContextMenu); 
    5353        Config & config = ConfigManager::getInstance().getCurrentConfig(); 
    54         QString themeDir = QString::fromStdString(config.getChatTheme()); 
    5554 
    5655        _theme = new QtChatTheme(); 
    57         setTheme(themeDir); 
     56        setTheme(QString::fromStdString(config.getChatTheme()),QString::fromStdString(config.getChatThemeVariant())); 
    5857         
    5958        QWebFrame *     frame = page()->mainFrame ();  
     
    7877} 
    7978 
    80 void QtChatHistoryWidget::setTheme(const QString& themeDir) { 
     79void QtChatHistoryWidget::setTheme(const QString& themeDir,const QString & variant) { 
    8180        _theme->load(themeDir); 
    8281        Config & config = ConfigManager::getInstance().getCurrentConfig(); 
    8382         
    84         QFile file(_theme->getCurrentThemePath()+"/main.css"); 
    85         file.open(QIODevice::ReadOnly); 
    86         QUrl url_css("data:text/css;charset=utf-8;base64,"+file.readAll().toBase64()); 
    87         page()->settings()->setUserStyleSheetUrl(url_css); 
     83        QString Resources_path; 
     84         
     85#if defined(OS_WINDOWS) 
     86        Resources_path = _theme->getCurrentThemePath(); 
     87#else 
     88        Resources_path = "file://"+_theme->getCurrentThemePath(); 
     89#endif 
     90 
     91        Resources_path += "Contents/Resources/"; 
    8892         
    8993        page()->mainFrame()->addToJavaScriptWindowObject("parent",this); 
    9094        QFile file_base(QString::fromStdString(config.getResourcesDir())+"chat/base.html"); 
    9195        file_base.open(QIODevice::ReadOnly); 
    92 #if defined(OS_WINDOWS) 
    93         setHtml(file_base.readAll(),QUrl(_theme->getCurrentThemePath())); 
    94 #else 
    95         setHtml(file_base.readAll(),QUrl("file://"+_theme->getCurrentThemePath())); 
    96 #endif 
    97          
     96         
     97        QString base = file_base.readAll(); 
     98         
     99        qDebug() << variant; 
     100         
     101        if (variant.isEmpty()) 
     102                base.replace("%cssPath%",""); 
     103        else  
     104                base.replace("%cssPath%","Variants/"+variant+".css"); 
     105 
     106        setHtml(base,QUrl(Resources_path)); 
    98107} 
    99108 
     
    188197        QtChatTheme::setKeywordValue(html, "senderId", contactId); 
    189198        QtChatTheme::setKeywordValue(html, "sender", senderName); 
     199        QtChatTheme::setKeywordValue(html, "message", "<div id='magic_id'>"+htmlMessage+"</div>"); 
    190200        QtChatTheme::setKeywordValue(html, "time", time.toString("HH:mm")); 
    191         QtChatTheme::setKeywordValue(html, "message", "<div id='magic_id'>"+htmlMessage+"</div>"); 
     201        QtChatTheme::setKeywordValue(html, "time{%I:%M %p}",time.toString("HH:mm")); 
     202        QtChatTheme::setKeywordValue(html, "shortTime", time.toString("HH:mm")); 
     203        QtChatTheme::setKeywordValue(html, "timeOpened{%1m/%e/%y %1H:%1M:%1S %p}",QTime::currentTime().toString("HH:mm")); 
     204        QtChatTheme::setKeywordValue(html, "timeOpened{%I:%M %p}",QTime::currentTime().toString("HH:mm")); 
     205        QtChatTheme::setKeywordValue(html, "timeOpened{%H:%M}",QTime::currentTime().toString("HH:mm")); 
     206        QtChatTheme::setKeywordValue(html, "timeOpened",QTime::currentTime().toString("HH:mm")); 
    192207        QtChatTheme::setKeywordValue(html, "service", ""); 
    193208 
  • wengophone/src/presentation/qt/chat/QtChatHistoryWidget.h

    r562 r579  
    4848        ~QtChatHistoryWidget(); 
    4949 
    50         void setTheme(const QString& themeDir); 
     50        void setTheme(const QString& themeDir , const QString& variant = ""); 
    5151 
    5252        void insertMessage(const QString & contactId, const QString & senderName, const QString & str, const QTime & time); 
  • wengophone/src/presentation/qt/chat/QtChatTheme.cpp

    r513 r579  
    8989        _currentThemePath = themeBaseDir() + themeDir + "/"; 
    9090 
    91         _incomingContent = loadFile(_currentThemePath + "Incoming/Content.html"); 
    92         _incomingNextContent = loadFile(_currentThemePath + "Incoming/NextContent.html"); 
    93         _outgoingContent = loadFile(_currentThemePath + "Outgoing/Content.html"); 
    94         _outgoingNextContent = loadFile(_currentThemePath + "Outgoing/NextContent.html"); 
    95         _footer = loadFile(_currentThemePath + "Footer.html"); 
    96         _statusMessage = loadFile(_currentThemePath + "Status.html"); 
    97         _styleSheet = loadFile(_currentThemePath + "main.css"); 
     91        _incomingContent = loadFile(_currentThemePath + "Contents/Resources/Incoming/Content.html"); 
     92        _incomingNextContent = loadFile(_currentThemePath + "Contents/Resources/Incoming/NextContent.html"); 
     93        _outgoingContent = loadFile(_currentThemePath + "Contents/Resources/Outgoing/Content.html"); 
     94        _outgoingNextContent = loadFile(_currentThemePath + "Contents/Resources/Outgoing/NextContent.html"); 
     95        _footer = loadFile(_currentThemePath + "Contents/Resources/Footer.html"); 
     96        _statusMessage = loadFile(_currentThemePath + "Contents/Resources/Status.html"); 
     97        _styleSheet = loadFile(_currentThemePath + "Contents/Resources/main.css"); 
    9898} 
    9999 
     
    117117        return list; 
    118118} 
     119 
     120QStringList QtChatTheme::getThemeListVariant(const QString & theme) { 
     121        QDir dir(themeBaseDir() +theme+ "/Contents/Resources/Variants"); 
     122         
     123        QStringList result; 
     124        QStringList filters; 
     125        filters << "*.css"; 
     126         
     127        dir.setNameFilters(filters); 
     128        QFileInfoList infoList = dir.entryInfoList(); 
     129        for(int i = 0 ; i < infoList.count() ; i ++) 
     130                result.append(infoList.at(i).baseName()); 
     131                                         
     132        return result; 
     133} 
  • wengophone/src/presentation/qt/chat/QtChatTheme.h

    r499 r579  
    4949 
    5050        static QStringList getThemeList(); 
     51        static QStringList getThemeListVariant(const QString &); 
    5152         
    5253        QString getCurrentThemePath(); 
  • wengophone/src/presentation/qt/config/AppearanceSettings.ui

    r0 r579  
    1 <ui version="4.0" > 
     1<?xml version="1.0" encoding="UTF-8"?> 
     2<ui version="4.0"> 
    23 <class>AppearanceSettings</class> 
    3  <widget class="QWidget" name="AppearanceSettings" > 
    4   <property name="geometry" > 
     4 <widget class="QWidget" name="AppearanceSettings"> 
     5  <property name="geometry"> 
    56   <rect> 
    67    <x>0</x> 
     
    1011   </rect> 
    1112  </property> 
    12   <property name="windowTitle" > 
     13  <property name="windowTitle"> 
    1314   <string>Form</string> 
    1415  </property> 
    15   <layout class="QVBoxLayout" > 
    16    <property name="margin" > 
    17     <number>9</number> 
    18    </property> 
    19    <property name="spacing" > 
    20     <number>6</number> 
    21    </property> 
    22    <item> 
    23     <widget class="QGroupBox" name="groupBox" > 
    24      <property name="title" > 
     16  <layout class="QGridLayout" name="gridLayout_2"> 
     17   <item row="0" column="0"> 
     18    <widget class="QGroupBox" name="groupBox"> 
     19     <property name="title"> 
    2520      <string>Toolbar</string> 
    2621     </property> 
    27      <layout class="QVBoxLayout" > 
    28       <property name="margin" > 
    29        <number>9</number> 
    30       </property> 
    31       <property name="spacing" > 
    32        <number>6</number> 
    33       </property> 
     22     <layout class="QVBoxLayout"> 
    3423      <item> 
    35        <widget class="QRadioButton" name="textUnderIconsRadioButton" > 
    36         <property name="text" > 
     24       <widget class="QRadioButton" name="textUnderIconsRadioButton"> 
     25        <property name="text"> 
    3726         <string>&amp;Icons &amp;&amp; Text</string> 
    3827        </property> 
    39         <property name="checked" > 
     28        <property name="checked"> 
    4029         <bool>true</bool> 
    4130        </property> 
     
    4332      </item> 
    4433      <item> 
    45        <widget class="QRadioButton" name="iconsOnlyRadioButton" > 
    46         <property name="text" > 
     34       <widget class="QRadioButton" name="iconsOnlyRadioButton"> 
     35        <property name="text"> 
    4736         <string>Icons &amp;Only</string> 
    4837        </property> 
     
    5039      </item> 
    5140      <item> 
    52        <widget class="QRadioButton" name="hiddenRadioButton" > 
    53         <property name="text" > 
     41       <widget class="QRadioButton" name="hiddenRadioButton"> 
     42        <property name="text"> 
    5443         <string>&amp;Hidden</string> 
    5544        </property> 
     
    5948    </widget> 
    6049   </item> 
    61    <item> 
    62     <widget class="QGroupBox" name="groupBox_2" > 
    63      <property name="title" > 
     50   <item row="1" column="0"> 
     51    <widget class="QGroupBox" name="groupBox_2"> 
     52     <property name="title"> 
    6453      <string>Chat Theme</string> 
    6554     </property> 
    66      <layout class="QHBoxLayout" > 
    67       <property name="margin" > 
    68        <number>9</number> 
    69       </property> 
    70       <property name="spacing" > 
    71        <number>6</number> 
    72       </property> 
    73       <item> 
    74        <widget class="QListWidget" name="themeListWidget" > 
    75         <property name="sizePolicy" > 
    76          <sizepolicy> 
    77           <hsizetype>1</hsizetype> 
    78           <vsizetype>7</vsizetype> 
     55     <layout class="QGridLayout" name="gridLayout"> 
     56      <item row="0" column="0" rowspan="2"> 
     57       <widget class="QListWidget" name="themeListWidget"> 
     58        <property name="sizePolicy"> 
     59         <sizepolicy hsizetype="Minimum" vsizetype="Expanding"> 
    7960          <horstretch>0</horstretch> 
    8061          <verstretch>0</verstretch> 
     
    8364       </widget> 
    8465      </item> 
    85       <item> 
    86        <widget class="QtChatHistoryWidget" name="themePreviewBrowser" /> 
     66      <item row="0" column="1"> 
     67       <widget class="QComboBox" name="comboBox"/> 
     68      </item> 
     69      <item row="1" column="1"> 
     70       <widget class="QtChatHistoryWidget" name="themePreviewBrowser"/> 
    8771      </item> 
    8872     </layout> 
  • wengophone/src/presentation/qt/config/QtAppearanceSettings.cpp

    r562 r579  
    4949#endif 
    5050                 
    51         SAFE_CONNECT(_ui->themeListWidget, SIGNAL(currentRowChanged(int)), 
    52                 SLOT(updatePreview()) ); 
     51        SAFE_CONNECT(_ui->themeListWidget,SIGNAL(itemClicked(QListWidgetItem *)),SLOT(updatePreview()) ); 
    5352 
    5453        readConfig(); 
     
    5655                 
    5756        connect(_ui->themePreviewBrowser,SIGNAL(loadFinished(bool)),this,SLOT(loadFinished(bool))); 
     57        connect(_ui->comboBox,SIGNAL(activated(const QString & )),this,SLOT(activatedVariant( const QString &))); 
    5858} 
    5959 
     
    6262} 
    6363 
     64void QtAppearanceSettings::activatedVariant ( const QString & variant ) 
     65{ 
     66        QListWidgetItem* item = _ui->themeListWidget->currentItem(); 
     67        if (!item) { 
     68                return; 
     69        } 
     70         
     71        int row = _ui->themeListWidget->row(item); 
     72        QString theme = _themeList[row]; 
     73         
     74        _ui->themePreviewBrowser->setTheme(theme,variant); 
     75} 
     76 
    6477void QtAppearanceSettings::updatePreview() { 
    6578        _ui->themePreviewBrowser->clear(); 
     79        _ui->comboBox->clear(); 
    6680 
    6781        QListWidgetItem* item = _ui->themeListWidget->currentItem(); 
     
    6983                return; 
    7084        } 
     85         
     86        Config & config = ConfigManager::getInstance().getCurrentConfig(); 
    7187 
    7288        int row = _ui->themeListWidget->row(item); 
    7389        QString theme = _themeList[row]; 
    74         _ui->themePreviewBrowser->setTheme(theme); 
     90         
     91        _ui->comboBox->addItems(QtChatTheme::getThemeListVariant(theme)); 
     92        _ui->themePreviewBrowser->setTheme(theme,_ui->comboBox->currentText ()); 
    7593         
    7694} 
     
    121139                QString theme = _themeList[row]; 
    122140                config.set(Config::APPEARANCE_CHATTHEME_KEY, theme.toStdString()); 
     141                config.set(Config::APPEARANCE_CHATTHEMEVARIANT_KEY, _ui->comboBox->currentText ().toStdString()); 
    123142        } else { 
    124143                LOG_WARN("No current chat theme"); 
     
    153172                _ui->themeListWidget->addItem(item); 
    154173                if (themeDir == currentTheme) { 
     174                        _ui->comboBox->addItems(QtChatTheme::getThemeListVariant(themeDir)); 
     175                        _ui->comboBox->setCurrentIndex(_ui->comboBox->findText (QString::fromStdString(config.getChatThemeVariant()))); 
     176                         
    155177                        _ui->themeListWidget->setCurrentItem(item); 
     178                        _ui->themePreviewBrowser->setTheme(currentTheme,_ui->comboBox->currentText ()); 
    156179                } 
    157180        } 
  • wengophone/src/presentation/qt/config/QtAppearanceSettings.h

    r562 r579  
    5555        void updatePreview(); 
    5656        void loadFinished ( bool ok ); 
     57        void activatedVariant ( const QString & variant ); 
    5758 
    5859private: 
Note: See TracChangeset for help on using the changeset viewer.