Commit 90c06f3e authored by Dirk Wilden's avatar Dirk Wilden

translation + viewerLayout options

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6738 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 859c5527
......@@ -246,6 +246,20 @@ void Core::readApplicationOptions(INIFile& _ini) {
if ( _ini.get_entry( toolboxMode, "Options" , "DefaultToolboxMode") )
OpenFlipper::Options::defaultToolboxMode(toolboxMode);
//============================================================================
// Load the setting for the translation language
//============================================================================
QString translation = false;
if ( _ini.get_entry( translation, "Options" , "Translation") )
OpenFlipper::Options::translation(translation);
//============================================================================
// Load the setting for the viewer layout
//============================================================================
int viewerLayout = 0;
if ( _ini.get_entry( viewerLayout, "Options" , "DefaultViewerLayout") )
OpenFlipper::Options::defaultViewerLayout(viewerLayout);
//============================================================================
// Load the viewer settings
//============================================================================
......@@ -255,13 +269,13 @@ void Core::readApplicationOptions(INIFile& _ini) {
for (int i=0; i < 4/*PluginFunctions::viewers()*/; i++ ){
if( _ini.get_entry(draw_modes, "Options", "DefaultDrawModes" + QString::number(i) ) )
OpenFlipper::Options::defaultDrawMode( ListToDrawMode(draw_modes), i );
OpenFlipper::Options::defaultDrawMode( ListToDrawMode(draw_modes), i );
if( _ini.get_entry(mode, "Options", "DefaultProjectionMode" + QString::number(i) ) )
OpenFlipper::Options::defaultProjectionMode( mode, i );
OpenFlipper::Options::defaultProjectionMode( mode, i );
if( _ini.get_entry(mode, "Options", "DefaultViewingDirection" + QString::number(i) ) )
OpenFlipper::Options::defaultViewingDirection( mode, i );
OpenFlipper::Options::defaultViewingDirection( mode, i );
}
//============================================================================
......@@ -554,6 +568,9 @@ void Core::writeApplicationOptions(INIFile& _ini) {
if ( OpenFlipper::Options::gui() ) {
_ini.add_entry("Options","DefaultViewerLayout", OpenFlipper::Options::defaultViewerLayout() );
_ini.add_entry("Options","Translation", OpenFlipper::Options::translation() );
_ini.add_entry("Options","MultiView", OpenFlipper::Options::multiView() );
_ini.add_entry("Options","ViewerCount", OpenFlipper::Options::examinerWidgets() );
......
......@@ -109,13 +109,16 @@ void Core::applyOptions(){
//only switch projection here if an object is opened
//this prevents problems when applying options on app start
if ( PluginFunctions::objectCount() > 0 ){
if ( OpenFlipper::Options::defaultProjectionMode(i) == 0 )
PluginFunctions::orthographicProjection(i);
else
PluginFunctions::perspectiveProjection(i);
if ( OpenFlipper::Options::defaultProjectionMode(i) == 0 )
PluginFunctions::orthographicProjection(i);
else
PluginFunctions::perspectiveProjection(i);
}
}
if ( OpenFlipper::Options::multiView() )
coreWidget_->setViewMode( OpenFlipper::Options::defaultViewerLayout() );
//set defaultBackgroundColor
QColor c = OpenFlipper::Options::defaultBackgroundColor() ;
......
......@@ -318,10 +318,15 @@ int main(int argc, char **argv)
if ( !parseCommandLineOptions(args) )
return 1;
QString tLang = OpenFlipper::Options::translation();
if (tLang == "locale")
tLang = QLocale::system().name();
// Install translator for qt internals
QTranslator qtTranslator;
std::cerr << "Loading qt translations from: " << QLibraryInfo::location(QLibraryInfo::TranslationsPath).toStdString() << std::endl;
if ( qtTranslator.load("qt_" + QLocale::system().name(),
if ( qtTranslator.load("qt_" + tLang,
QLibraryInfo::location(QLibraryInfo::TranslationsPath)) )
std::cerr << "Loaded" << std::endl;
......@@ -329,8 +334,9 @@ int main(int argc, char **argv)
// install translator for Core Application
QTranslator myappTranslator;
std::cerr << "Loading own translations from: " << QString(OpenFlipper::Options::translationsDirStr() + QDir::separator() + "OpenFlipper_" + QLocale::system().name()).toStdString() << std::endl;
if ( myappTranslator.load(OpenFlipper::Options::translationsDirStr() + QDir::separator() + "OpenFlipper__" + QLocale::system().name()) )
std::cerr << "Loading own translations from: " << QString(OpenFlipper::Options::translationsDirStr() + QDir::separator() + "OpenFlipper_" + tLang).toStdString() << std::endl;
if ( myappTranslator.load(OpenFlipper::Options::translationsDirStr() + QDir::separator() + "OpenFlipper_" + tLang) )
std::cerr << "Loaded" << std::endl;
app.installTranslator(&myappTranslator);
......
......@@ -163,6 +163,9 @@ static std::vector<int> defaultProjectionMode_ = std::vector<int> (4, 1);
/// Store the defaultViewingDirection_ mode
static std::vector<int> defaultViewingDirection_ = std::vector<int> (4, 0);
/// Store the defaultViewer layout
static int defaultViewerLayout_ = 0;
/// Store the disableRedraw_ mode
static int redrawDisabled_ = 0;
......@@ -227,6 +230,9 @@ static QString logFile_;
/// last used DataType
static QString lastDataType_ = "Triangle Mesh";
/// translation
static QString translation_ = "en_US";
/// Should backups be enabled
static bool enableBackup_ = true;
......@@ -292,6 +298,13 @@ QString lang() {
return lang;
}
QString translation() {
return translation_;
}
void translation(QString _translation) {
translation_ = _translation;
}
QString dirSeparator() {
// if (windows_)
......@@ -686,6 +699,14 @@ int defaultViewingDirection(int _viewer){
return defaultViewingDirection_[_viewer];
}
void defaultViewerLayout( int _layout ){
defaultViewerLayout_ = _layout;
}
int defaultViewerLayout(){
return defaultViewerLayout_;
}
void redrawDisabled( bool disable ){
if ( disable )
redrawDisabled_++;
......
......@@ -377,6 +377,14 @@ bool dataDir(QString _dir);
DLLEXPORT
QString lang();
/// Returns the translation language (locale, de_DE, en_US)
DLLEXPORT
QString translation();
/// Set the translation language (locale, de_DE, en_US)
DLLEXPORT
void translation(QString _translation);
/** @} */
//===========================================================================
......@@ -551,6 +559,14 @@ bool dataDir(QString _dir);
DLLEXPORT
int defaultViewingDirection( int _viewer );
/// Store defaultViewerLayout setting
DLLEXPORT
void defaultViewerLayout( int _layout );
/// get defaultViewerLayout setting
DLLEXPORT
int defaultViewerLayout();
/// Store disableRedraw setting
DLLEXPORT
void redrawDisabled( bool disable );
......
......@@ -548,13 +548,14 @@ public:
/// Setup and update the global draw menu
void slotUpdateGlobalDrawMenu();
private slots:
/// Switches over to the next view mode
void nextViewMode();
/// Change view mode that was selected in the combo box
void setViewMode(int _idx);
private slots:
/// Switches over to the next view mode
void nextViewMode();
/// Called when the global drawMode is selected
void slotGlobalDrawMenu(QAction * _action);
......
......@@ -293,6 +293,15 @@ void OptionsWidget::showEvent ( QShowEvent * /*event*/ ) {
updateViewerSettings(0);
viewerLayout->setCurrentIndex( OpenFlipper::Options::defaultViewerLayout() );
if (OpenFlipper::Options::translation() == "en_US")
translation->setCurrentIndex(0);
else if (OpenFlipper::Options::translation() == "de_DE")
translation->setCurrentIndex(1);
else
translation->setCurrentIndex(2);
updateVersionsTable();
}
......@@ -534,6 +543,14 @@ void OptionsWidget::slotApply() {
OpenFlipper::Options::defaultViewingDirection( defaultViewingDirections_[i], i );
}
OpenFlipper::Options::defaultViewerLayout( viewerLayout->currentIndex() );
switch ( translation->currentIndex() ){
case 0 : OpenFlipper::Options::translation("en_US"); break;
case 1 : OpenFlipper::Options::translation("de_DE"); break;
default: OpenFlipper::Options::translation("locale"); break;
}
applyShortcuts();
emit applyOptions();
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>604</width>
<height>819</height>
<width>590</width>
<height>808</height>
</rect>
</property>
<property name="windowTitle">
......@@ -23,7 +23,7 @@
<string/>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<property name="usesScrollButtons">
<bool>true</bool>
......@@ -32,7 +32,7 @@
<attribute name="title">
<string>General</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="fullscreen">
<property name="toolTip">
......@@ -122,6 +122,42 @@
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_19">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Translation:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="translation">
<item>
<property name="text">
<string>English (en_US)</string>
</property>
</item>
<item>
<property name="text">
<string>Deutsch (de_DE)</string>
</property>
</item>
<item>
<property name="text">
<string>System locale</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......@@ -165,7 +201,7 @@
<attribute name="title">
<string>Viewer</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_9">
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
......@@ -244,7 +280,7 @@
<property name="title">
<string>General Viewer Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
......@@ -349,6 +385,54 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<item>
<widget class="QLabel" name="label_18">
<property name="text">
<string>Viewer Layout:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="viewerLayout">
<item>
<property name="text">
<string>Single Viewer</string>
</property>
</item>
<item>
<property name="text">
<string>Four Viewers</string>
</property>
</item>
<item>
<property name="text">
<string>One + Three Viewers</string>
</property>
</item>
<item>
<property name="text">
<string/>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
......@@ -363,7 +447,7 @@
<property name="title">
<string>Viewer Specific Settings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<layout class="QHBoxLayout" name="horizontalLayout_19">
<item>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
......@@ -408,7 +492,7 @@
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="label_7">
<property name="toolTip">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment