Working on #93.
This commit is contained in:
		
							parent
							
								
									91f9dd7a9c
								
							
						
					
					
						commit
						9fef53f812
					
				
					 4 changed files with 59 additions and 11 deletions
				
			
		|  | @ -9,7 +9,7 @@ Fixed: | |||
| Added: | ||||
| <ul> | ||||
| <li>Settings/database can now experimentally be exported/imported.</li> | ||||
| <li>Added Swedish localization (thanks to Åke Engelbrektson).</li> | ||||
| <li>Added Swedish localization (thanks to Åke Engelbrektson).</li> | ||||
| <li>Parent item is now selected when adding new category/feed with that parent pre-selected in feed view.</li> | ||||
| </ul> | ||||
| 
 | ||||
|  |  | |||
|  | @ -93,7 +93,7 @@ | |||
|    <item row="0" column="1"> | ||||
|     <widget class="QStackedWidget" name="m_stackedSettings"> | ||||
|      <property name="currentIndex"> | ||||
|       <number>0</number> | ||||
|       <number>6</number> | ||||
|      </property> | ||||
|      <widget class="QWidget" name="m_pageGeneral"> | ||||
|       <layout class="QFormLayout" name="formLayout_5"> | ||||
|  | @ -400,8 +400,8 @@ Authors of this application are NOT responsible for lost data.</string> | |||
|            <rect> | ||||
|             <x>0</x> | ||||
|             <y>0</y> | ||||
|             <width>100</width> | ||||
|             <height>30</height> | ||||
|             <width>684</width> | ||||
|             <height>451</height> | ||||
|            </rect> | ||||
|           </property> | ||||
|           <layout class="QHBoxLayout" name="horizontalLayout_4"> | ||||
|  | @ -478,8 +478,8 @@ Authors of this application are NOT responsible for lost data.</string> | |||
|                <rect> | ||||
|                 <x>0</x> | ||||
|                 <y>0</y> | ||||
|                 <width>167</width> | ||||
|                 <height>219</height> | ||||
|                 <width>678</width> | ||||
|                 <height>425</height> | ||||
|                </rect> | ||||
|               </property> | ||||
|               <layout class="QFormLayout" name="formLayout"> | ||||
|  | @ -1163,7 +1163,7 @@ Authors of this application are NOT responsible for lost data.</string> | |||
|        <item> | ||||
|         <widget class="QTabWidget" name="m_tabFeedsMessages"> | ||||
|          <property name="currentIndex"> | ||||
|           <number>0</number> | ||||
|           <number>1</number> | ||||
|          </property> | ||||
|          <widget class="QWidget" name="m_tabFeeds"> | ||||
|           <attribute name="title"> | ||||
|  | @ -1286,6 +1286,49 @@ Authors of this application are NOT responsible for lost data.</string> | |||
|              </property> | ||||
|             </widget> | ||||
|            </item> | ||||
|            <item row="2" column="0"> | ||||
|             <widget class="QGroupBox" name="m_grpMessagesDateTimeFormat"> | ||||
|              <property name="title"> | ||||
|               <string>Use custom date/time format (overrides format loaded from active localization)</string> | ||||
|              </property> | ||||
|              <property name="checkable"> | ||||
|               <bool>true</bool> | ||||
|              </property> | ||||
|              <property name="checked"> | ||||
|               <bool>false</bool> | ||||
|              </property> | ||||
|              <layout class="QFormLayout" name="formLayout_19"> | ||||
|               <item row="0" column="0"> | ||||
|                <widget class="QLabel" name="label_11"> | ||||
|                 <property name="text"> | ||||
|                  <string>Format code</string> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="0" column="1"> | ||||
|                <widget class="QComboBox" name="m_cmbMessagesDateTimeFormat"> | ||||
|                 <property name="editable"> | ||||
|                  <bool>true</bool> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="1" column="0"> | ||||
|                <widget class="QLabel" name="label_12"> | ||||
|                 <property name="text"> | ||||
|                  <string>Example</string> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|               <item row="1" column="1"> | ||||
|                <widget class="QLabel" name="m_lblMessagesDateTimeFormat"> | ||||
|                 <property name="text"> | ||||
|                  <string/> | ||||
|                 </property> | ||||
|                </widget> | ||||
|               </item> | ||||
|              </layout> | ||||
|             </widget> | ||||
|            </item> | ||||
|           </layout> | ||||
|          </widget> | ||||
|         </widget> | ||||
|  |  | |||
|  | @ -55,9 +55,7 @@ void Localization::loadActiveLanguage() { | |||
|     desired_localization = DEFAULT_LOCALE; | ||||
|   } | ||||
| 
 | ||||
|   if (qt_translator->load(QString("qt-%1.qm").arg(desired_localization), | ||||
|                           APP_LANG_PATH, | ||||
|                           "-")) { | ||||
|   if (qt_translator->load(QString("qt-%1.qm").arg(desired_localization), APP_LANG_PATH, "-")) { | ||||
|     Application::installTranslator(qt_translator); | ||||
|     qDebug("Qt localization '%s' loaded successfully.", qPrintable(desired_localization)); | ||||
|   } | ||||
|  | @ -66,7 +64,8 @@ void Localization::loadActiveLanguage() { | |||
|   } | ||||
| 
 | ||||
|   m_loadedLanguage = desired_localization; | ||||
|   QLocale::setDefault(QLocale(desired_localization)); | ||||
|   m_loadedLocale = QLocale(desired_localization); | ||||
|   QLocale::setDefault(m_loadedLocale); | ||||
| } | ||||
| 
 | ||||
| QList<Language> Localization::installedLanguages() { | ||||
|  |  | |||
|  | @ -21,6 +21,7 @@ | |||
| #include <QObject> | ||||
| 
 | ||||
| #include <QString> | ||||
| #include <QLocale> | ||||
| 
 | ||||
| 
 | ||||
| struct Language { | ||||
|  | @ -58,9 +59,14 @@ class Localization : public QObject { | |||
|       return m_loadedLanguage; | ||||
|     } | ||||
| 
 | ||||
|     inline QLocale loadedLocale() const { | ||||
|       return m_loadedLocale; | ||||
|     } | ||||
| 
 | ||||
|   private: | ||||
|     // Code of loaded language.
 | ||||
|     QString m_loadedLanguage; | ||||
|     QLocale m_loadedLocale; | ||||
| }; | ||||
| 
 | ||||
| #endif // LOCALIZATION_H
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue