Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
07aaa19b
Commit
07aaa19b
authored
Jun 22, 2012
by
Aleksei Kanash
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:Sankore/Sankore-3.1
Conflicts: src/board/UBBoardController.cpp
parents
47cdb048
28bb7a67
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
137 additions
and
65 deletions
+137
-65
lgpl.txt
lgpl.txt
+1
-1
UBBoardController.cpp
src/board/UBBoardController.cpp
+0
-1
UBApplication.cpp
src/core/UBApplication.cpp
+49
-18
UBApplication.h
src/core/UBApplication.h
+1
-0
UBFileSystemUtils.cpp
src/frameworks/UBFileSystemUtils.cpp
+2
-2
UBFileSystemUtils.h
src/frameworks/UBFileSystemUtils.h
+1
-1
UBPlatformUtils.h
src/frameworks/UBPlatformUtils.h
+3
-2
UBPlatformUtils_linux.cpp
src/frameworks/UBPlatformUtils_linux.cpp
+14
-3
UBPlatformUtils_mac.mm
src/frameworks/UBPlatformUtils_mac.mm
+51
-18
UBPlatformUtils_win.cpp
src/frameworks/UBPlatformUtils_win.cpp
+13
-4
UBDocumentNavigator.cpp
src/gui/UBDocumentNavigator.cpp
+0
-8
UBLeftPalette.cpp
src/gui/UBLeftPalette.cpp
+1
-1
UBRightPalette.cpp
src/gui/UBRightPalette.cpp
+1
-1
UBThumbnailWidget.cpp
src/gui/UBThumbnailWidget.cpp
+0
-5
No files found.
lgpl.txt
View file @
07aaa19b
src/board/UBBoardController.cpp
View file @
07aaa19b
...
@@ -1234,7 +1234,6 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
...
@@ -1234,7 +1234,6 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
if
(
documentChange
)
if
(
documentChange
)
{
{
emit
activeDocumentChanged
();
emit
activeDocumentChanged
();
// Notify the navigator palette that the document has changed
emit
setDocOnPageNavigator
(
pDocumentProxy
);
emit
setDocOnPageNavigator
(
pDocumentProxy
);
UBGraphicsTextItem
::
lastUsedTextColor
=
QColor
();
UBGraphicsTextItem
::
lastUsedTextColor
=
QColor
();
}
}
...
...
src/core/UBApplication.cpp
View file @
07aaa19b
...
@@ -135,27 +135,13 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing
...
@@ -135,27 +135,13 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing
UBResources
::
resources
();
UBResources
::
resources
();
if
(
!
undoStack
)
if
(
!
undoStack
)
{
undoStack
=
new
QUndoStack
(
staticMemoryCleaner
);
undoStack
=
new
QUndoStack
(
staticMemoryCleaner
);
}
mApplicationTranslator
=
new
QTranslator
(
this
);
mApplicationTranslator
->
load
(
UBPlatformUtils
::
preferredTranslation
(
QString
(
"sankore_"
)));
installTranslator
(
mApplicationTranslator
);
QString
localString
;
QString
forcedLanguage
(
""
);
if
(
!
mApplicationTranslator
->
isEmpty
())
if
(
args
.
contains
(
"-lang"
))
localString
=
UBPlatformUtils
::
preferredLanguage
();
forcedLanguage
=
args
.
at
(
args
.
indexOf
(
"-lang"
)
+
1
);
else
localString
=
"en_US"
;
mQtGuiTranslator
=
new
QTranslator
(
this
);
mQtGuiTranslator
->
load
(
UBPlatformUtils
::
preferredTranslation
(
QString
(
"qt_"
)));
installTranslator
(
mQtGuiTranslator
);
setupTranslator
(
forcedLanguage
);
QLocale
::
setDefault
(
QLocale
(
localString
));
qDebug
()
<<
"Running application in:"
<<
localString
;
UBSettings
*
settings
=
UBSettings
::
settings
();
UBSettings
*
settings
=
UBSettings
::
settings
();
...
@@ -217,6 +203,51 @@ UBApplication::~UBApplication()
...
@@ -217,6 +203,51 @@ UBApplication::~UBApplication()
staticMemoryCleaner
=
0
;
staticMemoryCleaner
=
0
;
}
}
void
UBApplication
::
setupTranslator
(
QString
forcedLanguage
)
{
QStringList
availablesTranslations
=
UBPlatformUtils
::
availableTranslations
();
QString
language
(
""
);
if
(
!
forcedLanguage
.
isEmpty
()){
if
(
availablesTranslations
.
contains
(
forcedLanguage
,
Qt
::
CaseInsensitive
))
language
=
forcedLanguage
;
else
qDebug
()
<<
"forced language "
<<
forcedLanguage
<<
" not available"
;
}
else
{
QString
systemLanguage
=
UBPlatformUtils
::
systemLanguage
();
if
(
availablesTranslations
.
contains
(
systemLanguage
,
Qt
::
CaseInsensitive
))
language
=
systemLanguage
;
else
qDebug
()
<<
"translation for system language "
<<
systemLanguage
<<
" not found"
;
}
if
(
language
.
isEmpty
()){
language
=
"en_US"
;
//fallback if no translation are available
}
else
{
mApplicationTranslator
=
new
QTranslator
(
this
);
mQtGuiTranslator
=
new
QTranslator
(
this
);
mApplicationTranslator
->
load
(
UBPlatformUtils
::
translationPath
(
QString
(
"sankore_"
),
language
));
installTranslator
(
mApplicationTranslator
);
mQtGuiTranslator
->
load
(
UBPlatformUtils
::
translationPath
(
QString
(
"qt_"
),
language
));
if
(
!
mQtGuiTranslator
->
isEmpty
()){
// checked because this translation could be not available
installTranslator
(
mQtGuiTranslator
);
}
else
qDebug
()
<<
"Qt gui translation in "
<<
language
<<
" are not available"
;
}
QLocale
::
setDefault
(
QLocale
(
language
));
qDebug
()
<<
"Running application in:"
<<
language
;
}
int
UBApplication
::
exec
(
const
QString
&
pFileToImport
)
int
UBApplication
::
exec
(
const
QString
&
pFileToImport
)
{
{
QPixmapCache
::
setCacheLimit
(
1024
*
100
);
QPixmapCache
::
setCacheLimit
(
1024
*
100
);
...
...
src/core/UBApplication.h
View file @
07aaa19b
...
@@ -121,6 +121,7 @@ class UBApplication : public QtSingleApplication
...
@@ -121,6 +121,7 @@ class UBApplication : public QtSingleApplication
private
:
private
:
void
updateProtoActionsState
();
void
updateProtoActionsState
();
void
setupTranslator
(
QString
forcedLanguage
);
QList
<
QMenu
*>
mProtoMenus
;
QList
<
QMenu
*>
mProtoMenus
;
bool
mIsVerbose
;
bool
mIsVerbose
;
...
...
src/frameworks/UBFileSystemUtils.cpp
View file @
07aaa19b
...
@@ -177,7 +177,7 @@ void UBFileSystemUtils::cleanupGhostTempFolders(const QString& templateString)
...
@@ -177,7 +177,7 @@ void UBFileSystemUtils::cleanupGhostTempFolders(const QString& templateString)
}
}
QStringList
UBFileSystemUtils
::
allFiles
(
const
QString
&
pDirPath
)
QStringList
UBFileSystemUtils
::
allFiles
(
const
QString
&
pDirPath
,
bool
isRecursive
)
{
{
QStringList
result
;
QStringList
result
;
if
(
pDirPath
==
""
||
pDirPath
==
"."
||
pDirPath
==
".."
)
if
(
pDirPath
==
""
||
pDirPath
==
"."
||
pDirPath
==
".."
)
...
@@ -187,7 +187,7 @@ QStringList UBFileSystemUtils::allFiles(const QString& pDirPath)
...
@@ -187,7 +187,7 @@ QStringList UBFileSystemUtils::allFiles(const QString& pDirPath)
foreach
(
QFileInfo
dirContent
,
dir
.
entryInfoList
(
QDir
::
Files
|
QDir
::
Dirs
|
QDir
::
NoDotAndDotDot
,
QDir
::
Name
))
foreach
(
QFileInfo
dirContent
,
dir
.
entryInfoList
(
QDir
::
Files
|
QDir
::
Dirs
|
QDir
::
NoDotAndDotDot
,
QDir
::
Name
))
{
{
if
(
dirContent
.
isDir
())
if
(
isRecursive
&&
dirContent
.
isDir
())
{
{
result
<<
allFiles
(
dirContent
.
absoluteFilePath
());
result
<<
allFiles
(
dirContent
.
absoluteFilePath
());
}
}
...
...
src/frameworks/UBFileSystemUtils.h
View file @
07aaa19b
...
@@ -37,7 +37,7 @@ class UBFileSystemUtils
...
@@ -37,7 +37,7 @@ class UBFileSystemUtils
static
QFileInfoList
allElementsInDirectory
(
const
QString
&
pDirPath
);
static
QFileInfoList
allElementsInDirectory
(
const
QString
&
pDirPath
);
static
QStringList
allFiles
(
const
QString
&
pDirPath
);
static
QStringList
allFiles
(
const
QString
&
pDirPath
,
const
bool
isRecurive
=
true
);
static
bool
deleteDir
(
const
QString
&
pDirPath
);
static
bool
deleteDir
(
const
QString
&
pDirPath
);
...
...
src/frameworks/UBPlatformUtils.h
View file @
07aaa19b
...
@@ -103,8 +103,8 @@ class UBPlatformUtils
...
@@ -103,8 +103,8 @@ class UBPlatformUtils
static
void
setFileType
(
const
QString
&
filePath
,
unsigned
long
fileType
);
static
void
setFileType
(
const
QString
&
filePath
,
unsigned
long
fileType
);
static
void
fadeDisplayOut
();
static
void
fadeDisplayOut
();
static
void
fadeDisplayIn
();
static
void
fadeDisplayIn
();
static
QString
preferredTranslation
(
QString
pFilePrefix
);
static
QString
translationPath
(
QString
pFilePrefix
,
QString
pLanguage
);
static
QString
preferred
Language
();
static
QString
system
Language
();
static
bool
hasVirtualKeyboard
();
static
bool
hasVirtualKeyboard
();
//static void showVirtualKeyboard();
//static void showVirtualKeyboard();
static
void
runInstaller
(
const
QString
&
installerFilePath
);
static
void
runInstaller
(
const
QString
&
installerFilePath
);
...
@@ -115,6 +115,7 @@ class UBPlatformUtils
...
@@ -115,6 +115,7 @@ class UBPlatformUtils
static
QString
computerName
();
static
QString
computerName
();
static
UBKeyboardLocale
**
getKeyboardLayouts
(
int
&
nCount
);
static
UBKeyboardLocale
**
getKeyboardLayouts
(
int
&
nCount
);
static
QString
urlFromClipboard
();
static
QString
urlFromClipboard
();
static
QStringList
availableTranslations
();
};
};
...
...
src/frameworks/UBPlatformUtils_linux.cpp
View file @
07aaa19b
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
#include <X11/Xlib.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/keysym.h>
#include "frameworks/UBFileSystemUtils.h"
void
UBPlatformUtils
::
init
()
void
UBPlatformUtils
::
init
()
{
{
...
@@ -55,13 +57,22 @@ void UBPlatformUtils::fadeDisplayIn()
...
@@ -55,13 +57,22 @@ void UBPlatformUtils::fadeDisplayIn()
// NOOP
// NOOP
}
}
QString
UBPlatformUtils
::
preferredTranslation
(
QString
pFilePrefix
)
QStringList
UBPlatformUtils
::
availableTranslations
()
{
QString
translationsPath
=
applicationResourcesDirectory
()
+
"/"
+
"i18n"
+
"/"
;
QStringList
translationsList
=
UBFileSystemUtils
::
allFiles
(
translationsPath
);
QRegExp
sankoreTranslationFiles
(
".*sankore_.*.qm"
);
translationsList
=
translationsList
.
filter
(
sankoreTranslationFiles
);
return
translationsList
.
replaceInStrings
(
QRegExp
(
"(.*)sankore_(.*).qm"
),
"
\\
2"
);
}
QString
UBPlatformUtils
::
translationPath
(
QString
pFilePrefix
,
QString
pLanguage
)
{
{
QString
qmPath
=
applicationResourcesDirectory
()
+
"/"
+
"i18n"
+
"/"
+
pFilePrefix
+
p
referredLanguage
()
+
".qm"
;
QString
qmPath
=
applicationResourcesDirectory
()
+
"/"
+
"i18n"
+
"/"
+
pFilePrefix
+
p
Language
+
".qm"
;
return
qmPath
;
return
qmPath
;
}
}
QString
UBPlatformUtils
::
preferred
Language
()
QString
UBPlatformUtils
::
system
Language
()
{
{
return
QLocale
::
system
().
name
();
return
QLocale
::
system
().
name
();
}
}
...
...
src/frameworks/UBPlatformUtils_mac.mm
View file @
07aaa19b
...
@@ -184,31 +184,64 @@ void UBPlatformUtils::fadeDisplayIn()
...
@@ -184,31 +184,64 @@ void UBPlatformUtils::fadeDisplayIn()
}
}
}
}
QString UBPlatformUtils::preferredTranslation(QString pFilePrefix)
{
QString qmPath;
NSString* filePrefix = [[NSString alloc] initWithUTF8String:(const char*)(pFilePrefix.toUtf8())];
//QString UBPlatformUtils::preferredTranslation(QString pFilePrefix)
//{
// QString qmPath;
// NSString* filePrefix = [[NSString alloc] initWithUTF8String:(const char*)(pFilePrefix.toUtf8())];
// NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// NSString *lprojPath = [[[NSBundle mainBundle] pathForResource:@"Localizable" ofType:@"strings"] stringByDeletingLastPathComponent];
// if (lprojPath)
// {
// NSString *lang = [[lprojPath lastPathComponent] stringByDeletingPathExtension];
// NSString *translationFilePath = [lprojPath stringByAppendingPathComponent:[[filePrefix stringByAppendingString:lang] stringByAppendingPathExtension:@"qm"]];
// qmPath = QString::fromUtf8([translationFilePath UTF8String], strlen([translationFilePath UTF8String]));
// }
// [pool drain];
// return qmPath;
//}
//QString UBPlatformUtils::preferredLanguage()
//{
// QFileInfo qmFileInfo = QFileInfo(preferredTranslation("sankore_"));
// QDir lprojPath = qmFileInfo.dir();
// QFileInfo lprojFileInfo = QFileInfo(lprojPath.absolutePath());
// return lprojFileInfo.baseName();
//}
QStringList UBPlatformUtils::availableTranslations()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *lprojPath = [[NSBundle mainBundle] resourcePath];
QString translationsPath = QString::fromUtf8([lprojPath UTF8String], strlen([lprojPath UTF8String]));
QStringList translationsList = UBFileSystemUtils::allFiles(translationsPath, false);
QRegExp sankoreTranslationFiles(".*lproj");
translationsList=translationsList.filter(sankoreTranslationFiles);
[pool drain];
return translationsList.replaceInStrings(QRegExp("(.*)/(.*).lproj"),"\\2");
}
NSString *lprojPath = [[[NSBundle mainBundle] pathForResource:@"Localizable" ofType:@"strings"] stringByDeletingLastPathComponent];
QString UBPlatformUtils::translationPath(QString pFilePrefix, QString pLanguage)
if (lprojPath)
{
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSString *lang = [[lprojPath lastPathComponent] stringByDeletingPathExtension];
NSString *lprojPath = [[NSBundle mainBundle] resourcePath];
NSString *translationFilePath = [lprojPath stringByAppendingPathComponent:[[filePrefix stringByAppendingString:lang] stringByAppendingPathExtension:@"qm"]];
QString translationsPath = QString::fromUtf8([lprojPath UTF8String], strlen([lprojPath UTF8String]));
qmPath = QString::fromUtf8([translationFilePath UTF8String], strlen([translationFilePath UTF8String]));
}
[pool drain];
[pool drain];
return
qmPath
;
return
translationsPath + "/" + pLanguage + ".lproj/" + pFilePrefix + pLanguage + ".qm"
;
}
}
QString UBPlatformUtils::
preferred
Language()
QString UBPlatformUtils::
system
Language()
{
{
QFileInfo qmFileInfo = QFileInfo(preferredTranslation("sankore_"));
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
QDir lprojPath = qmFileInfo.dir();
NSUserDefaults* defs = [NSUserDefaults standardUserDefaults];
QFileInfo lprojFileInfo = QFileInfo(lprojPath.absolutePath());
NSArray* languages = [defs objectForKey:@"AppleLanguages"];
return lprojFileInfo.baseName();
NSString* preferredLang = [languages objectAtIndex:0];
QString result = QString::fromUtf8([preferredLang UTF8String], strlen([preferredLang UTF8String]));
[pool drain];
return result;
}
}
void UBPlatformUtils::runInstaller(const QString &installerFilePath)
void UBPlatformUtils::runInstaller(const QString &installerFilePath)
...
...
src/frameworks/UBPlatformUtils_win.cpp
View file @
07aaa19b
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include <windows.h>
#include <windows.h>
#include <shellapi.h>
#include <shellapi.h>
#include "frameworks/UBFileSystemUtils.h"
#include "core/memcheck.h"
#include "core/memcheck.h"
void
UBPlatformUtils
::
init
()
void
UBPlatformUtils
::
init
()
...
@@ -59,14 +60,22 @@ void UBPlatformUtils::fadeDisplayIn()
...
@@ -59,14 +60,22 @@ void UBPlatformUtils::fadeDisplayIn()
// NOOP
// NOOP
}
}
QString
UBPlatformUtils
::
preferredTranslation
(
QString
pFilePrefix
)
QString
List
UBPlatformUtils
::
availableTranslations
(
)
{
{
QString
localPreferredLanguage
=
preferredLanguage
();
QString
translationsPath
=
applicationResourcesDirectory
()
+
"/"
+
"i18n"
+
"/"
;
QString
qmPath
=
applicationResourcesDirectory
()
+
"/"
+
"i18n"
+
"/"
+
pFilePrefix
+
localPreferredLanguage
+
".qm"
;
QStringList
translationsList
=
UBFileSystemUtils
::
allFiles
(
translationsPath
);
QRegExp
sankoreTranslationFiles
(
".*sankore_.*.qm"
);
translationsList
=
translationsList
.
filter
(
sankoreTranslationFiles
);
return
translationsList
.
replaceInStrings
(
QRegExp
(
"(.*)sankore_(.*).qm"
),
"
\\
2"
);
}
QString
UBPlatformUtils
::
translationPath
(
QString
pFilePrefix
,
QString
pLanguage
)
{
QString
qmPath
=
applicationResourcesDirectory
()
+
"/"
+
"i18n"
+
"/"
+
pFilePrefix
+
pLanguage
+
".qm"
;
return
qmPath
;
return
qmPath
;
}
}
QString
UBPlatformUtils
::
preferred
Language
()
QString
UBPlatformUtils
::
system
Language
()
{
{
return
QLocale
::
system
().
name
();
return
QLocale
::
system
().
name
();
}
}
...
...
src/gui/UBDocumentNavigator.cpp
View file @
07aaa19b
...
@@ -263,14 +263,6 @@ void UBDocumentNavigator::resizeEvent(QResizeEvent *event)
...
@@ -263,14 +263,6 @@ void UBDocumentNavigator::resizeEvent(QResizeEvent *event)
// Update the thumbnails width
// Update the thumbnails width
mThumbnailWidth
=
(
width
()
>
mThumbnailMinWidth
)
?
width
()
-
2
*
border
()
:
mThumbnailMinWidth
;
mThumbnailWidth
=
(
width
()
>
mThumbnailMinWidth
)
?
width
()
-
2
*
border
()
:
mThumbnailMinWidth
;
// Update the scene rect
// QRect sceneRect;
// sceneRect.setWidth(width() - 2*border());
// sceneRect.setHeight(height() - 2*border());
// sceneRect.moveLeft(border());
// sceneRect.moveTop(border());
// scene()->setSceneRect(sceneRect);
// Refresh the scene
// Refresh the scene
refreshScene
();
refreshScene
();
}
}
...
...
src/gui/UBLeftPalette.cpp
View file @
07aaa19b
...
@@ -45,7 +45,7 @@ UBLeftPalette::~UBLeftPalette()
...
@@ -45,7 +45,7 @@ UBLeftPalette::~UBLeftPalette()
*/
*/
void
UBLeftPalette
::
updateMaxWidth
()
void
UBLeftPalette
::
updateMaxWidth
()
{
{
setMaximumWidth
(
270
);
setMaximumWidth
(
(
int
)(
parentWidget
()
->
width
()
*
0.45
)
);
}
}
/**
/**
...
...
src/gui/UBRightPalette.cpp
View file @
07aaa19b
...
@@ -69,7 +69,7 @@ void UBRightPalette::resizeEvent(QResizeEvent *event)
...
@@ -69,7 +69,7 @@ void UBRightPalette::resizeEvent(QResizeEvent *event)
*/
*/
void
UBRightPalette
::
updateMaxWidth
()
void
UBRightPalette
::
updateMaxWidth
()
{
{
setMaximumWidth
((
int
)(
(
parentWidget
()
->
width
()
*
2
)
/
3
));
setMaximumWidth
((
int
)(
parentWidget
()
->
width
()
*
0.45
));
setMaximumHeight
(
parentWidget
()
->
height
());
setMaximumHeight
(
parentWidget
()
->
height
());
setMinimumHeight
(
parentWidget
()
->
height
());
setMinimumHeight
(
parentWidget
()
->
height
());
}
}
src/gui/UBThumbnailWidget.cpp
View file @
07aaa19b
...
@@ -887,11 +887,6 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh
...
@@ -887,11 +887,6 @@ void UBImgTextThumbnailElement::Place(int row, int col, qreal width, qreal heigh
qreal
scaleFactor
=
qMin
(
scaleWidth
,
scaleHeight
);
qreal
scaleFactor
=
qMin
(
scaleWidth
,
scaleHeight
);
UBThumbnail
*
pix
=
dynamic_cast
<
UBThumbnail
*>
(
this
->
thumbnail
);
UBThumbnail
*
pix
=
dynamic_cast
<
UBThumbnail
*>
(
this
->
thumbnail
);
if
(
pix
)
{
scaleFactor
=
qMin
(
scaleFactor
,
1.0
);
}
QTransform
transform
;
QTransform
transform
;
transform
.
scale
(
scaleFactor
,
scaleFactor
);
transform
.
scale
(
scaleFactor
,
scaleFactor
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment