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
88f8a7bc
Commit
88f8a7bc
authored
Dec 09, 2015
by
agriche
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "- Take in account the local systeme language."
This reverts commit
fb05343e
.
parent
fb05343e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
103 deletions
+14
-103
UBApplication.cpp
src/core/UBApplication.cpp
+14
-103
No files found.
src/core/UBApplication.cpp
View file @
88f8a7bc
...
@@ -27,15 +27,11 @@
...
@@ -27,15 +27,11 @@
#include "UBApplication.h"
#include "UBApplication.h"
#include <QtWidgets>
#include <QtGui>
#include <QtWebKit>
#include <QtWebKit>
#include <QtXml>
#include <QtXml>
#include <QFontDatabase>
#include <QFontDatabase>
#include <QStyleFactory>
#if defined(Q_WS_MACX)
#include <Carbon/Carbon.h>
#endif
#include "frameworks/UBPlatformUtils.h"
#include "frameworks/UBPlatformUtils.h"
#include "frameworks/UBFileSystemUtils.h"
#include "frameworks/UBFileSystemUtils.h"
...
@@ -85,33 +81,12 @@ const QString UBApplication::mimeTypeUniboardPage = QString("application/vnd.mne
...
@@ -85,33 +81,12 @@ const QString UBApplication::mimeTypeUniboardPage = QString("application/vnd.mne
const
QString
UBApplication
::
mimeTypeUniboardPageItem
=
QString
(
"application/vnd.mnemis-uniboard-page-item"
);
const
QString
UBApplication
::
mimeTypeUniboardPageItem
=
QString
(
"application/vnd.mnemis-uniboard-page-item"
);
const
QString
UBApplication
::
mimeTypeUniboardPageThumbnail
=
QString
(
"application/vnd.mnemis-uniboard-thumbnail"
);
const
QString
UBApplication
::
mimeTypeUniboardPageThumbnail
=
QString
(
"application/vnd.mnemis-uniboard-thumbnail"
);
#ifdef Q_
WS_MAC
#ifdef Q_
OS_OSX
bool
bIsMinimized
=
false
;
bool
bIsMinimized
=
false
;
#endif
#endif
QObject
*
UBApplication
::
staticMemoryCleaner
=
0
;
QObject
*
UBApplication
::
staticMemoryCleaner
=
0
;
#if defined(Q_WS_MAC)
static
OSStatus
ub_appleEventProcessor
(
const
AppleEvent
*
ae
,
AppleEvent
*
event
,
long
handlerRefCon
)
{
Q_UNUSED
(
event
);
OSType
aeID
=
typeWildCard
;
OSType
aeClass
=
typeWildCard
;
AEGetAttributePtr
(
ae
,
keyEventClassAttr
,
typeType
,
0
,
&
aeClass
,
sizeof
(
aeClass
),
0
);
AEGetAttributePtr
(
ae
,
keyEventIDAttr
,
typeType
,
0
,
&
aeID
,
sizeof
(
aeID
),
0
);
if
(
aeClass
==
kCoreEventClass
&&
aeID
==
kAEReopenApplication
)
{
// User clicked on Uniboard in the Dock
((
UBApplicationController
*
)
handlerRefCon
)
->
hideDesktop
();
return
noErr
;
}
return
eventNotHandledErr
;
}
#endif
UBApplication
::
UBApplication
(
const
QString
&
id
,
int
&
argc
,
char
**
argv
)
:
QtSingleApplication
(
id
,
argc
,
argv
)
UBApplication
::
UBApplication
(
const
QString
&
id
,
int
&
argc
,
char
**
argv
)
:
QtSingleApplication
(
id
,
argc
,
argv
)
,
mPreferencesController
(
NULL
)
,
mPreferencesController
(
NULL
)
...
@@ -154,17 +129,11 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing
...
@@ -154,17 +129,11 @@ UBApplication::UBApplication(const QString &id, int &argc, char **argv) : QtSing
connect
(
settings
->
appToolBarDisplayText
,
SIGNAL
(
changed
(
QVariant
)),
this
,
SLOT
(
toolBarDisplayTextChanged
(
QVariant
)));
connect
(
settings
->
appToolBarDisplayText
,
SIGNAL
(
changed
(
QVariant
)),
this
,
SLOT
(
toolBarDisplayTextChanged
(
QVariant
)));
updateProtoActionsState
();
updateProtoActionsState
();
#ifndef Q_
WS_MAC
#ifndef Q_
OS_OSX
setWindowIcon
(
QIcon
(
":/images/OpenBoard.png"
));
setWindowIcon
(
QIcon
(
":/images/OpenBoard.png"
));
#endif
#endif
setStyle
(
"fusion"
);
//QApplication::setStyle(new UBStyle()); // Style is owned and deleted by the application
//QApplication::setStyle(QStyleFactory::create("Fusion"));
//UBStyle *style_appli new UBStyle();
//QApplication::setStyle(style_appli); // Style is owned and deleted by the application
QString
css
=
UBFileSystemUtils
::
readTextFile
(
UBPlatformUtils
::
applicationResourcesDirectory
()
+
"/etc/"
+
qApp
->
applicationName
()
+
".css"
);
QString
css
=
UBFileSystemUtils
::
readTextFile
(
UBPlatformUtils
::
applicationResourcesDirectory
()
+
"/etc/"
+
qApp
->
applicationName
()
+
".css"
);
if
(
css
.
length
()
>
0
)
if
(
css
.
length
()
>
0
)
...
@@ -214,22 +183,14 @@ UBApplication::~UBApplication()
...
@@ -214,22 +183,14 @@ UBApplication::~UBApplication()
QString
UBApplication
::
checkLanguageAvailabilityForSankore
(
QString
&
language
)
QString
UBApplication
::
checkLanguageAvailabilityForSankore
(
QString
&
language
)
{
{
QStringList
availableTranslations
=
UBPlatformUtils
::
availableTranslations
();
QStringList
availableTranslations
=
UBPlatformUtils
::
availableTranslations
();
//QStringList availableTranslations ;availableTranslations<< "OpenBoard_fr";
if
(
availableTranslations
.
contains
(
language
,
Qt
::
CaseInsensitive
))
if
(
availableTranslations
.
contains
(
language
,
Qt
::
CaseInsensitive
))
return
language
;
return
language
;
else
{
else
{
if
(
language
.
length
()
>
2
){
if
(
language
.
length
()
>
2
){
QString
shortLanguageCode
=
language
.
left
(
2
);
QString
shortLanguageCode
=
language
.
left
(
2
);
//if(availableTranslations.contains(shortLanguageCode,Qt::CaseInsensitive))
if
(
availableTranslations
.
contains
(
shortLanguageCode
,
Qt
::
CaseInsensitive
))
bool
find_lang
=
false
;
foreach
(
const
QString
&
str
,
availableTranslations
)
{
if
(
str
.
contains
(
shortLanguageCode
))
return
shortLanguageCode
;
return
shortLanguageCode
;
}
}
//if(availableTranslations.contains(shortLanguageCode))
//return shortLanguageCode;
}
}
}
return
QString
(
""
);
return
QString
(
""
);
}
}
...
@@ -248,12 +209,6 @@ void UBApplication::setupTranslators(QStringList args)
...
@@ -248,12 +209,6 @@ void UBApplication::setupTranslators(QStringList args)
// forcedLanguage = setLanguage;
// forcedLanguage = setLanguage;
// }
// }
else
{
QString
setLanguage
=
UBSettings
::
settings
()
->
appPreferredLanguage
->
get
().
toString
();
if
(
!
setLanguage
.
isEmpty
())
forcedLanguage
=
setLanguage
;
}
QString
language
(
""
);
QString
language
(
""
);
if
(
!
forcedLanguage
.
isEmpty
())
if
(
!
forcedLanguage
.
isEmpty
())
...
@@ -261,7 +216,6 @@ void UBApplication::setupTranslators(QStringList args)
...
@@ -261,7 +216,6 @@ void UBApplication::setupTranslators(QStringList args)
if
(
language
.
isEmpty
()){
if
(
language
.
isEmpty
()){
QString
systemLanguage
=
UBPlatformUtils
::
systemLanguage
();
QString
systemLanguage
=
UBPlatformUtils
::
systemLanguage
();
//QString systemLanguage = "fr_CH";
language
=
checkLanguageAvailabilityForSankore
(
systemLanguage
);
language
=
checkLanguageAvailabilityForSankore
(
systemLanguage
);
}
}
...
@@ -359,7 +313,7 @@ int UBApplication::exec(const QString& pFileToImport)
...
@@ -359,7 +313,7 @@ int UBApplication::exec(const QString& pFileToImport)
connect
(
mainWindow
->
actionDesktop
,
SIGNAL
(
triggered
(
bool
)),
applicationController
,
SLOT
(
showDesktop
(
bool
)));
connect
(
mainWindow
->
actionDesktop
,
SIGNAL
(
triggered
(
bool
)),
applicationController
,
SLOT
(
showDesktop
(
bool
)));
connect
(
mainWindow
->
actionDesktop
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
stopScript
()));
connect
(
mainWindow
->
actionDesktop
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
stopScript
()));
#ifndef Q_
WS_MAC
#ifndef Q_
OS_OSX
connect
(
mainWindow
->
actionHideApplication
,
SIGNAL
(
triggered
()),
mainWindow
,
SLOT
(
showMinimized
()));
connect
(
mainWindow
->
actionHideApplication
,
SIGNAL
(
triggered
()),
mainWindow
,
SLOT
(
showMinimized
()));
#else
#else
connect
(
mainWindow
->
actionHideApplication
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showMinimized
()));
connect
(
mainWindow
->
actionHideApplication
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showMinimized
()));
...
@@ -389,11 +343,6 @@ int UBApplication::exec(const QString& pFileToImport)
...
@@ -389,11 +343,6 @@ int UBApplication::exec(const QString& pFileToImport)
if
(
pFileToImport
.
length
()
>
0
)
if
(
pFileToImport
.
length
()
>
0
)
UBApplication
::
applicationController
->
importFile
(
pFileToImport
);
UBApplication
::
applicationController
->
importFile
(
pFileToImport
);
#if defined(Q_OS_OSX)
static
AEEventHandlerUPP
ub_proc_ae_handlerUPP
=
AEEventHandlerUPP
(
ub_appleEventProcessor
);
AEInstallEventHandler
(
kCoreEventClass
,
kAEReopenApplication
,
ub_proc_ae_handlerUPP
,
SRefCon
(
UBApplication
::
applicationController
),
true
);
#endif
if
(
UBSettings
::
settings
()
->
appStartMode
->
get
().
toInt
())
if
(
UBSettings
::
settings
()
->
appStartMode
->
get
().
toInt
())
applicationController
->
showDesktop
();
applicationController
->
showDesktop
();
else
else
...
@@ -411,14 +360,14 @@ void UBApplication::onScreenCountChanged(int newCount)
...
@@ -411,14 +360,14 @@ void UBApplication::onScreenCountChanged(int newCount)
mainWindow
->
actionMultiScreen
->
setEnabled
(
displayManager
.
numScreens
()
>
1
);
mainWindow
->
actionMultiScreen
->
setEnabled
(
displayManager
.
numScreens
()
>
1
);
}
}
#ifdef Q_WS_MAC
void
UBApplication
::
showMinimized
()
void
UBApplication
::
showMinimized
()
{
{
#ifdef Q_OS_OSX
mainWindow
->
hide
();
mainWindow
->
hide
();
bIsMinimized
=
true
;
bIsMinimized
=
true
;
#endif
}
}
#endif
void
UBApplication
::
startScript
()
void
UBApplication
::
startScript
()
{
{
...
@@ -560,7 +509,7 @@ void UBApplication::decorateActionMenu(QAction* action)
...
@@ -560,7 +509,7 @@ void UBApplication::decorateActionMenu(QAction* action)
menu
->
addSeparator
();
menu
->
addSeparator
();
#ifndef Q_
WS_X11
// No Podcast on Linux yet
#ifndef Q_
OS_LINUX
// No Podcast on Linux yet
menu
->
addAction
(
mainWindow
->
actionPodcast
);
menu
->
addAction
(
mainWindow
->
actionPodcast
);
mainWindow
->
actionPodcast
->
setText
(
tr
(
"Podcast"
));
mainWindow
->
actionPodcast
->
setText
(
tr
(
"Podcast"
));
#endif
#endif
...
@@ -611,11 +560,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
...
@@ -611,11 +560,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
{
{
QFileOpenEvent
*
fileToOpenEvent
=
static_cast
<
QFileOpenEvent
*>
(
event
);
QFileOpenEvent
*
fileToOpenEvent
=
static_cast
<
QFileOpenEvent
*>
(
event
);
#if defined(Q_WS_MACX)
UBPlatformUtils
::
setFrontProcess
();
ProcessSerialNumber
psn
;
GetCurrentProcess
(
&
psn
);
SetFrontProcess
(
&
psn
);
#endif
applicationController
->
importFile
(
fileToOpenEvent
->
file
());
applicationController
->
importFile
(
fileToOpenEvent
->
file
());
}
}
...
@@ -632,7 +577,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
...
@@ -632,7 +577,7 @@ bool UBApplication::eventFilter(QObject *obj, QEvent *event)
boardController
->
controlView
()
->
setMultiselection
(
false
);
boardController
->
controlView
()
->
setMultiselection
(
false
);
}
}
#ifdef Q_
WS_MAC
#ifdef Q_
OS_OSX
if
(
bIsMinimized
&&
event
->
type
()
==
QEvent
::
ApplicationActivate
){
if
(
bIsMinimized
&&
event
->
type
()
==
QEvent
::
ApplicationActivate
){
if
(
mainWindow
->
isHidden
())
mainWindow
->
show
();
if
(
mainWindow
->
isHidden
())
mainWindow
->
show
();
bIsMinimized
=
false
;
bIsMinimized
=
false
;
...
@@ -672,39 +617,6 @@ void UBApplication::cleanup()
...
@@ -672,39 +617,6 @@ void UBApplication::cleanup()
documentController
=
NULL
;
documentController
=
NULL
;
}
}
void
UBStyle
::
drawItemText
(
QPainter
*
painter
,
const
QRect
&
rect
,
int
alignment
,
const
QPalette
&
pal
,
bool
enabled
,
const
QString
&
text
,
QPalette
::
ColorRole
textRole
)
const
{
if
(
text
.
isEmpty
())
return
;
QPen
savedPen
;
if
(
textRole
!=
QPalette
::
NoRole
)
{
savedPen
=
painter
->
pen
();
painter
->
setPen
(
QPen
(
pal
.
brush
(
textRole
),
savedPen
.
widthF
()));
}
if
(
!
enabled
)
{
QPen
pen
=
painter
->
pen
();
QColor
half
=
pen
.
color
();
half
.
setRed
(
half
.
red
()
/
2
);
half
.
setGreen
(
half
.
green
()
/
2
);
half
.
setBlue
(
half
.
blue
()
/
2
);
painter
->
setPen
(
half
);
painter
->
drawText
(
rect
,
alignment
,
text
);
painter
->
setPen
(
pen
);
}
painter
->
drawText
(
rect
,
alignment
,
text
);
if
(
textRole
!=
QPalette
::
NoRole
)
painter
->
setPen
(
savedPen
);
}
QString
UBApplication
::
urlFromHtml
(
QString
html
)
QString
UBApplication
::
urlFromHtml
(
QString
html
)
{
{
QString
_html
;
QString
_html
;
...
@@ -734,8 +646,7 @@ bool UBApplication::isFromWeb(QString url)
...
@@ -734,8 +646,7 @@ bool UBApplication::isFromWeb(QString url)
{
{
bool
res
=
true
;
bool
res
=
true
;
if
(
//url.startsWith("uniboardTool://") ||
if
(
url
.
startsWith
(
"openboardtool://"
)
||
url
.
startsWith
(
"OpenboardTool://"
)
||
url
.
startsWith
(
"file://"
)
||
url
.
startsWith
(
"file://"
)
||
url
.
startsWith
(
"/"
)){
url
.
startsWith
(
"/"
)){
res
=
false
;
res
=
false
;
...
...
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