VirtualBox

Changeset 47136 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Jul 14, 2013 5:09:35 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Global preferences: *Language* page cleanup/rework.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/settings/global
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.cpp

    r44528 r47136  
    77
    88/*
    9  * Copyright (C) 2006-2012 Oracle Corporation
     9 * Copyright (C) 2006-2013 Oracle Corporation
    1010 *
    1111 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1818 */
    1919
    20 /* Global includes */
     20/* Qt includes: */
    2121#include <QDir>
    2222#include <QHeaderView>
     
    2424#include <QTranslator>
    2525
     26/* GUI includes: */
     27#include "UIGlobalSettingsLanguage.h"
     28#include "VBoxGlobalSettings.h"
     29#include "VBoxGlobal.h"
     30
     31/* Other VBox includes: */
    2632#include <iprt/err.h>
    2733#include <iprt/param.h>
    2834#include <iprt/path.h>
    2935#include <VBox/version.h>
    30 
    31 /* Local includes */
    32 #include "UIGlobalSettingsLanguage.h"
    33 #include "VBoxGlobalSettings.h"
    34 #include "VBoxGlobal.h"
    3536
    3637extern const char *gVBoxLangSubDir;
     
    179180    m_pLanguageTree->hideColumn(2);
    180181    m_pLanguageTree->hideColumn(3);
     182    m_pLanguageInfo->setWordWrapMode(QTextOption::WordWrap);
    181183
    182184    /* Setup connections: */
     
    210212    /* Fetch from cache: */
    211213    reload(m_cache.m_strLanguageId);
    212     m_pLanguageInfo->setFixedHeight(fontMetrics().height() * 4);
     214
     215    /* Remember current info-label width: */
     216    m_pLanguageInfo->setMinimumTextWidth(m_pLanguageInfo->width());
    213217}
    214218
     
    239243}
    240244
    241 /* Navigation stuff: */
    242245void UIGlobalSettingsLanguage::setOrderAfter(QWidget *pWidget)
    243246{
     247    /* Configure navigation: */
    244248    setTabOrder(pWidget, m_pLanguageTree);
    245249}
    246250
    247 /* Translation stuff: */
    248251void UIGlobalSettingsLanguage::retranslateUi()
    249252{
     
    255258}
    256259
    257 /* Reload language tree: */
    258260void UIGlobalSettingsLanguage::reload(const QString &strLangId)
    259261{
     
    296298
    297299    /* Adjust selector list: */
    298 #ifdef Q_WS_MAC
    299     int width = qMax(static_cast<QAbstractItemView*>(m_pLanguageTree)->sizeHintForColumn(0) +
    300                      2 * m_pLanguageTree->frameWidth() + QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent),
    301                      220);
    302     m_pLanguageTree->setFixedWidth(width);
    303 #else /* Q_WS_MAC */
    304     m_pLanguageTree->setMinimumWidth(static_cast<QAbstractItemView*>(m_pLanguageTree)->sizeHintForColumn(0) +
    305                                      2 * m_pLanguageTree->frameWidth() + QApplication::style()->pixelMetric(QStyle::PM_ScrollBarExtent));
    306 #endif /* Q_WS_MAC */
    307300    m_pLanguageTree->resizeColumnToContents(0);
    308301
     
    325318}
    326319
    327 /* Routine to paint language items: */
    328320void UIGlobalSettingsLanguage::sltLanguageItemPainted(QTreeWidgetItem *pItem, QPainter *pPainter)
    329321{
     
    341333}
    342334
    343 /* Slot to handle currently language change fact: */
    344335void UIGlobalSettingsLanguage::sltCurrentLanguageChanged(QTreeWidgetItem *pItem)
    345336{
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.h

    r44528 r47136  
    66
    77/*
    8  * Copyright (C) 2006-2012 Oracle Corporation
     8 * Copyright (C) 2006-2013 Oracle Corporation
    99 *
    1010 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2020#define __UIGlobalSettingsLanguage_h__
    2121
    22 /* Local includes */
     22/* GUI includes: */
    2323#include "UISettingsPage.h"
    2424#include "UIGlobalSettingsLanguage.gen.h"
     
    5656    void saveFromCacheTo(QVariant &data);
    5757
    58     /* Navigation stuff: */
     58    /* Helper: Navigation stuff: */
    5959    void setOrderAfter(QWidget *pWidget);
    6060
    61     /* Translation stuff: */
     61    /* Helper: Translation stuff: */
    6262    void retranslateUi();
    63 
    64     /* Reload language tree: */
    65     void reload(const QString &strLangId);
    6663
    6764private slots:
    6865
    69     /* Routine to paint language items: */
     66    /* Handler: List-painting stuff: */
    7067    void sltLanguageItemPainted(QTreeWidgetItem *pItem, QPainter *pPainter);
    7168
    72     /* Slot to handle current language change signal: */
     69    /* Handler: Current-changed stuff: */
    7370    void sltCurrentLanguageChanged(QTreeWidgetItem *pItem);
    7471
    7572private:
    7673
    77     /* Edited flag: */
     74    /* Helper: List-loading stuff: */
     75    void reload(const QString &strLangId);
     76
     77    /* Variables: */
    7878    bool m_fIsLanguageChanged;
    7979
     
    8383
    8484#endif // __UIGlobalSettingsLanguage_h__
    85 
  • trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsLanguage.ui

    r43106 r47136  
    1515 <class>UIGlobalSettingsLanguage</class>
    1616 <widget class="QWidget" name="UIGlobalSettingsLanguage">
    17   <property name="geometry">
    18    <rect>
    19     <x>0</x>
    20     <y>0</y>
    21     <width>350</width>
    22     <height>250</height>
    23    </rect>
    24   </property>
    2517  <layout class="QGridLayout">
    2618   <property name="margin">
     
    2820   </property>
    2921   <item row="0" column="0">
    30     <spacer>
    31      <property name="orientation">
    32       <enum>Qt::Horizontal</enum>
    33      </property>
    34      <property name="sizeType">
    35       <enum>QSizePolicy::Fixed</enum>
    36      </property>
    37      <property name="sizeHint">
    38       <size>
    39        <width>40</width>
    40        <height>20</height>
    41       </size>
    42      </property>
    43     </spacer>
    44    </item>
    45    <item row="0" column="1" colspan="2">
    46     <widget class="QLabel" name="m_pLanguageLabel">
     22    <widget class="QILabelSeparator" native="1" name="m_pLanguageLabel">
    4723     <property name="text">
    48       <string>&amp;Interface Language:</string>
     24      <string>&amp;Interface Languages</string>
    4925     </property>
    5026     <property name="buddy">
     
    5329    </widget>
    5430   </item>
    55    <item row="1" column="1">
    56     <spacer>
    57      <property name="orientation">
    58       <enum>Qt::Horizontal</enum>
    59      </property>
    60      <property name="sizeType">
    61       <enum>QSizePolicy::Fixed</enum>
    62      </property>
    63      <property name="sizeHint">
    64       <size>
    65        <width>20</width>
    66        <height>0</height>
    67       </size>
    68      </property>
    69     </spacer>
    70    </item>
    71    <item row="1" column="2">
     31   <item row="1" column="0">
    7232    <widget class="QITreeWidget" name="m_pLanguageTree">
    73      <property name="sizePolicy">
    74       <sizepolicy vsizetype="Expanding" hsizetype="Expanding">
    75        <horstretch>0</horstretch>
    76        <verstretch>0</verstretch>
    77       </sizepolicy>
    78      </property>
    79      <property name="minimumSize">
    80       <size>
    81        <width>0</width>
    82        <height>150</height>
    83       </size>
    84      </property>
    8533     <property name="whatsThis">
    8634      <string>Lists all available user interface languages. The effective language is written in &lt;b>bold&lt;/b>. Select &lt;i>Default&lt;/i> to reset to the system default language.</string>
     
    11159    </widget>
    11260   </item>
    113    <item row="2" column="2">
    114     <widget class="QILabel" name="m_pLanguageInfo">
    115      <property name="sizePolicy">
    116       <sizepolicy vsizetype="Minimum" hsizetype="Expanding">
    117        <horstretch>0</horstretch>
    118        <verstretch>0</verstretch>
    119       </sizepolicy>
    120      </property>
    121      <property name="alignment">
    122       <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
    123      </property>
    124      <property name="wordWrap">
    125       <bool>true</bool>
    126      </property>
    127     </widget>
     61   <item row="2" column="0">
     62    <widget class="QIRichTextLabel" name="m_pLanguageInfo"/>
    12863   </item>
    12964  </layout>
     
    13671  </customwidget>
    13772  <customwidget>
    138    <class>QILabel</class>
     73   <class>QIRichTextLabel</class>
     74   <extends>QTextEdit</extends>
     75   <header>QIRichTextLabel.h</header>
     76  </customwidget>
     77  <customwidget>
     78   <class>QILabelSeparator</class>
    13979   <extends>QLabel</extends>
    140    <header>QILabel.h</header>
     80   <header>QILabelSeparator.h</header>
    14181  </customwidget>
    14282 </customwidgets>
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette