Commits

Vincent Rabeux  committed 33fbdaf

Fixed compilation errors and cmake conf file.

  • Participants
  • Parent commits 042e5d1

Comments (0)

Files changed (9)

File documentImageCreator/src/gui/AncientDocumentEditor/CMakeLists.txt

 )
 
 
-set(fontfolder ../../../font)
-set(backgroundfolder ../../../background)
-set(xmlcheckerfolder ../../../xmlchecker)
-set(formatsfolder ../../../keyboard)
+set(fontfolder ../../../../font/)
+set(backgroundfolder ../../../../background/)
+set(xmlcheckerfolder ../../../../xmlchecker/)
+set(formatsfolder ../../../../keyboard/)
 
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/application.ini.in
                ${CMAKE_CURRENT_SOURCE_DIR}/src/application.ini

File documentImageCreator/src/gui/AncientDocumentEditor/application.ini.in

 [mainapp]
 
-fontfolder=../Resources/font/
-backgroundfolder=../Resources/background/
-xmlcheckerfolder=../Resources/xmlchecker/
+fontfolder=@fontfolder@
+backgroundfolder=@backgroundfolder@
+xmlcheckerfolder=@xmlcheckerfolder@
 documentxsdchecker=document.xsd
 defaultfont=vesale 
 defaultfontextension=.of
 pagesizey=1782
 
 [keyboard]
-formatsfolder=../Resources/keyboard/
+formatsfolder=@formatsfolder@
 defaultformat=fr_alternative.kb

File documentImageCreator/src/gui/AncientDocumentEditor/src/VirtualKeyboard/characterbuttonview.cpp

 	_characters.clear();
 }
 
+QAtomicInt CharacterButtonView::getCharacterValue(ModeTypeEnum mode)
+{
+    if(!_characters.keys().contains(mode))
+        return -1;
+    return _characters.value(mode);
+}
+
 QAtomicInt CharacterButtonView::getCharacterValue() 
 { 
 	if(!_characters.keys().contains(_currentMode))
 {
 	_currentMode = mode;
 }
-/* keyboard code value mapping with font code value: unicode 16 bit */
+// keyboard code value mapping with font code value: unicode 16 bit
 void CharacterButtonView::addKeyboardCodesMapToFontCodesValues(QAtomicInt kbCodeValue, QAtomicInt fontCodeValue){
     _keyboardCodesMapToFontCodesValues.insert(kbCodeValue,fontCodeValue);
 }
 QList<QAtomicInt> CharacterButtonView::getMappedFontCodeValues(){
     return _keyboardCodesMapToFontCodesValues.keys();
 }
+
 /* Character choice */
 void CharacterButtonView::openCharacterChoice()
 {
 /* Slots */
 void CharacterButtonView::buttonClicked()
 {
-	QChar c = (QChar)_characters.value(_currentMode);
-	_parent->processCharButton(c.unicode());
+    QChar c = (QChar)_characters.value(_currentMode);
+    QAtomicInt keyboardCode = _characters.value(_currentMode);
+    QAtomicInt fontCode = this->getFontCodeValue(keyboardCode);
+
+    _parent->processCharButton(c.unicode(),fontCode);
 }
 
 void CharacterButtonView::onCharacterItemClicked(CharacterListWidgetItem* charItem)

File documentImageCreator/src/gui/AncientDocumentEditor/src/VirtualKeyboard/characterbuttonview.h

 	void removeModeCharacter(ModeTypeEnum mode);
 	void clearCharacters();
 	QAtomicInt getCharacterValue();
+    QAtomicInt getCharacterValue(ModeTypeEnum mode);
 	QList<QAtomicInt> keys();
 
 	void setMode(ModeTypeEnum mode);
-    /* keyboard code value mapping with font code value: unicode 16 bit */
+    // keyboard code value mapping with font code value: unicode 16 bit
     void addKeyboardCodesMapToFontCodesValues(QAtomicInt kbCodeValue, QAtomicInt fontCodeValue);
     QAtomicInt getFontCodeValue(QAtomicInt kbCodeValue);
     QAtomicInt getFontCodeValue();
-    QList<QAtomicInt> getMappedFontCodeValues();	
+    QList<QAtomicInt> getMappedFontCodeValues();
 	/* Character choice dialog */
 	void openCharacterChoice();
 
 	void onCharacterItemClicked(CharacterListWidgetItem* charItem);
 
 private:
-	QMap<ModeTypeEnum, QAtomicInt> _characters ;
+    QMap<ModeTypeEnum, QAtomicInt> _characters ;
+    QMap<QAtomicInt, QAtomicInt> _keyboardCodesMapToFontCodesValues;
 	ModeTypeEnum _currentMode ;
 	KeyboardView* _parent ;
 	QPushButton * _chooseButton;

File documentImageCreator/src/gui/AncientDocumentEditor/src/VirtualKeyboard/keyboardcontroller.cpp

     _view->keyReleaseEvent(e);
 }
 
-#include <QApplication>
-
 void KeyboardController::update()
 {
-    QString keyboardPath = qApp->applicationDirPath()+"/"+Core::ConfigurationManager::get(AppConfigKeyBoardGroup, AppConfigKbFolderKey).toString()
+	QString keyboardPath = Core::ConfigurationManager::get(AppConfigKeyBoardGroup, AppConfigKbFolderKey).toString()
 		+ Core::ConfigurationManager::get(AppConfigKeyBoardGroup, AppConfigKbDefautlFormatKey).toString();
 
 	_view->drawKeyboard(Context::FontContext::instance()->getCurrentFont());

File documentImageCreator/src/gui/AncientDocumentEditor/src/VirtualKeyboard/keyboardview.cpp

 
 KeyboardView::KeyboardView()
 {
-	_documentController = NULL;
-	_fontEditorController = NULL;
-	_controller = NULL;
+    _documentController = NULL;
+    _fontEditorController = NULL;
+    _controller = NULL;
 
-	_ctrlPressed = _altPressed = _shiftPressed = _altGrPressed = false;
-	_currentMode = LowerCase ;
-	_currentFontName = "";
+    _ctrlPressed = _altPressed = _shiftPressed = _altGrPressed = false;
+    _currentMode = LowerCase ;
+    _currentFontName = "";
 }
 
 KeyboardView::~KeyboardView()
 /* Setters */
 void KeyboardView::setKeyboardController(KeyboardController* keyboardController)
 {
-	_controller = keyboardController;
-	_controller->setView(this);
+    _controller = keyboardController;
+    _controller->setView(this);
 }
 
 void KeyboardView::setDocumentController(DocumentController* documentController)
 {
-	_documentController = documentController;
+    _documentController = documentController;
 }
 
 void KeyboardView::setFontEditorController(FontEditorController* fontEditorController)
 {
-	_fontEditorController = fontEditorController;
+    _fontEditorController = fontEditorController;
 }
 
 
 
 void KeyboardView::keyReleaseEvent(QKeyEvent *e)
 {
-	processControlButtonRelease(e->key());	
+    processControlButtonRelease(e->key());
 }
 
 IController* KeyboardView::getController()
 { 
-	return _controller; 
+    return _controller;
 }
 
 void KeyboardView::addCharButtonView(CharacterButtonView* view)
 {
-	foreach(QAtomicInt id, view->keys())
-		_characterButtonViews.insert(id, view);
-	view->setParent(this);
+    foreach(QAtomicInt id, view->keys())
+        _characterButtonViews.insert(id, view);
+    view->setParent(this);
 }
 
 void KeyboardView::removeCharButtonView(const QAtomicInt & id)
 {
-	if(_characterButtonViews.contains(id))
-		_characterButtonViews.remove(id);
+    if(_characterButtonViews.contains(id))
+        _characterButtonViews.remove(id);
 }
 
 void KeyboardView::clearCharButtonViewList()
 {
-	foreach(CharacterButtonView* view, _characterButtonViews.values())
-	{
-		view->setParent(NULL);
-		delete view;
-	}
-	_characterButtonViews.clear();
+    foreach(CharacterButtonView* view, _characterButtonViews.values())
+    {
+        view->setParent(NULL);
+        delete view;
+    }
+    _characterButtonViews.clear();
 }
 
 void KeyboardView::addControlButton( const QAtomicInt & id, ControlButtonView * button)
 {
-	_controlButtons.insert(id, button);
-	button->setParent(this);
+    _controlButtons.insert(id, button);
+    button->setParent(this);
 }
 
 void KeyboardView::removeControlButton( const QAtomicInt & id )
 {
-	if(_controlButtons.contains(id))
-		_controlButtons.remove(id);
+    if(_controlButtons.contains(id))
+        _controlButtons.remove(id);
 }
 
 void KeyboardView::clearControlButtonsList()
 {
-	foreach(ControlButtonView* button, _controlButtons.values())
-	{
-		button->setParent(NULL);
-		delete button;
-	}
-	_controlButtons.clear();
+    foreach(ControlButtonView* button, _controlButtons.values())
+    {
+        button->setParent(NULL);
+        delete button;
+    }
+    _controlButtons.clear();
 }
 
 void KeyboardView::processCharButton(QAtomicInt keyboardCode,QAtomicInt fontCode, QAtomicInt id)
     }
 }
 
+void KeyboardView::processControlButton(QAtomicInt key)
+{
+    QAtomicInt controlKey = key;
+
+    if(controlKey == Qt::Key_Control)
+    {
+        _ctrlPressed = true;
+        _controlButtons.value(Qt::Key_Control)->pressKey();
+        redrawKeyboard();
+    }
+    else if(controlKey == Qt::Key_Alt)
+    {
+        _altPressed = true;
+        _controlButtons.value(Qt::Key_Alt)->pressKey();
+        redrawKeyboard();
+    }
+    else if(controlKey == Qt::Key_Shift)
+        _shiftPressed = true;
+    else if(controlKey == Qt::Key_AltGr)
+        _altGrPressed = true;
+
+    if(controlKey!=Qt::Key_Shift && _ctrlPressed && _altPressed)
+    {
+        controlKey = Qt::Key_AltGr;
+        _altGrPressed = true;
+    }
+
+    if(!_controlButtons.keys().contains(key))
+        return;
+
+    switch(controlKey)
+    {
+    case Qt::Key_Return://Enter
+        _documentController->addParagraph();
+        break;
+    case Qt::Key_Tab ://Tab
+        for(int i = 0; i < 3; ++i) //TODO: constant TAB_LENGHT
+            _documentController->addCharacter(" ");
+        break;
+    case Qt::Key_Delete://Del
+        _documentController->removeAfterCursor();
+        break;
+    case Qt::Key_Backspace://Backspace
+        _documentController->removeBeforeCursor();
+        break;
+    case Qt::Key_AltGr:
+        _currentMode = Alternate;
+        _controlButtons.value(Qt::Key_AltGr)->pressKey();
+        redrawKeyboard();
+        break;
+    case Qt::Key_Shift:
+        _currentMode = UpperCase;
+        _controlButtons.value(Qt::Key_Shift)->pressKey();
+        redrawKeyboard();
+        break;
+    default:
+        ;
+    }
+}
+
+void KeyboardView::processControlButtonRelease(QAtomicInt key)
+{
+    switch(key)
+    {
+    case Qt::Key_Control:
+        _ctrlPressed = false;
+        if(_shiftPressed && _altGrPressed)
+            _currentMode = UpperCase;
+        else
+        {
+            _currentMode = LowerCase;
+        }
+        _altGrPressed = false;
+        _controlButtons.value(Qt::Key_Control)->releaseKey();
+        _controlButtons.value(Qt::Key_AltGr)->releaseKey();
+        redrawKeyboard();
+        break;
+    case Qt::Key_Alt:
+        _altPressed = false;
+        if(_shiftPressed && _altGrPressed)
+            _currentMode = UpperCase;
+        else
+        {
+            _currentMode = LowerCase;
+        }
+        _altGrPressed = false;
+        _controlButtons.value(Qt::Key_Alt)->releaseKey();
+        _controlButtons.value(Qt::Key_AltGr)->releaseKey();
+        redrawKeyboard();
+        break;
+    case Qt::Key_AltGr:
+        _altGrPressed = false;
+        if(_shiftPressed)
+            _currentMode = UpperCase;
+        else
+            _currentMode = LowerCase;
+        _controlButtons.value(Qt::Key_AltGr)->releaseKey();
+        redrawKeyboard();
+        break;
+    case Qt::Key_Shift:
+        _shiftPressed = false;
+        if(_altGrPressed)
+            _currentMode = Alternate;
+        else
+            _currentMode = LowerCase;
+        _controlButtons.value(Qt::Key_Shift)->releaseKey();
+        redrawKeyboard();
+        break;
+    default: ;
+    }
+}
+
 void KeyboardView::mapKeyboardCodeValuesToFontCodes(Font *font){
 
     CharacterMap fontCharsMap = font->getCharacters();
                         if(!checkedFontCodes.contains(fontChar.unicode()->unicode()) && !checkedKBCodes.contains(keyboardCode_lowercase)){
                             fontCodeValue = fontChar.unicode()->unicode();
                             charButtonView->addKeyboardCodesMapToFontCodesValues(keyboardCode_lowercase,fontCodeValue);
+//                            qDebug() << "index " << indexChar << " char = " << fontChar << "kb code " << kbMappedCode << "font code " << fontCodeValue;
                             checkedFontCodes.push_back(fontCodeValue);
                             checkedKBCodes.push_back(keyboardCode_lowercase);
                             break;
                         if(!checkedFontCodes.contains(fontChar.unicode()->unicode()) && !checkedKBCodes.contains(keyboardCode_Uppercase)){
                             fontCodeValue = fontChar.unicode()->unicode();
                             charButtonView->addKeyboardCodesMapToFontCodesValues(keyboardCode_Uppercase,fontCodeValue);
+//                            qDebug() << "index " << indexChar << " char = " << fontChar << "kb code " << kbMappedCode << "font code " << fontCodeValue;
                             checkedFontCodes.push_back(fontCodeValue);
                             checkedKBCodes.push_back(keyboardCode_Uppercase);
                             break;
                         if(!checkedFontCodes.contains(fontChar.unicode()->unicode()) && !checkedKBCodes.contains(keyboardCode_Alternate)){
                             fontCodeValue = fontChar.unicode()->unicode();
                             charButtonView->addKeyboardCodesMapToFontCodesValues(keyboardCode_Alternate,fontCodeValue);
+//                            qDebug() << "index " << indexChar << " char = " << fontChar << "kb code " << kbMappedCode << "font code " << fontCodeValue;
                             checkedFontCodes.push_back(fontCodeValue);
                             checkedKBCodes.push_back(keyboardCode_Alternate);
                             break;
         }
 }
 
-void KeyboardView::processControlButton(QAtomicInt key)
-{
-	QAtomicInt controlKey = key;
-
-	if(controlKey == Qt::Key_Control)
-	{
-		_ctrlPressed = true;
-		_controlButtons.value(Qt::Key_Control)->pressKey();
-		redrawKeyboard();
-	}
-	else if(controlKey == Qt::Key_Alt)
-	{
-		_altPressed = true;
-		_controlButtons.value(Qt::Key_Alt)->pressKey();
-		redrawKeyboard();
-	}
-	else if(controlKey == Qt::Key_Shift)
-		_shiftPressed = true;
-	else if(controlKey == Qt::Key_AltGr)
-		_altGrPressed = true;
-	 
-	if(controlKey!=Qt::Key_Shift && _ctrlPressed && _altPressed)
-	{
-		controlKey = Qt::Key_AltGr;
-		_altGrPressed = true;
-	}
-
-	if(!_controlButtons.keys().contains(key))
-		return;
-
-	switch(controlKey)
-	{
-		case Qt::Key_Return://Enter
-			_documentController->addParagraph();
-			break;
-		case Qt::Key_Tab ://Tab
-			for(int i = 0; i < 3; ++i) //TODO: constant TAB_LENGHT
-				_documentController->addCharacter(" ");
-			break;
-		case Qt::Key_Delete://Del
-			_documentController->removeAfterCursor();
-			break;
-		case Qt::Key_Backspace://Backspace
-			_documentController->removeBeforeCursor();
-			break;
-		case Qt::Key_AltGr:
-			_currentMode = Alternate;
-			_controlButtons.value(Qt::Key_AltGr)->pressKey();
-			redrawKeyboard();
-			break;
-		case Qt::Key_Shift:
-			_currentMode = UpperCase;
-			_controlButtons.value(Qt::Key_Shift)->pressKey();
-			redrawKeyboard();
-			break;
-		default:
-			;
-	}	
-}
-
-void KeyboardView::processControlButtonRelease(QAtomicInt key)
-{
-	switch(key)
-	{
-		case Qt::Key_Control:
-			_ctrlPressed = false;
-			if(_shiftPressed && _altGrPressed)
-				_currentMode = UpperCase;
-			else
-			{
-				_currentMode = LowerCase;
-			}
-			_altGrPressed = false;
-			_controlButtons.value(Qt::Key_Control)->releaseKey();
-			_controlButtons.value(Qt::Key_AltGr)->releaseKey();
-			redrawKeyboard();
-			break;
-		case Qt::Key_Alt:
-			_altPressed = false;
-			if(_shiftPressed && _altGrPressed)
-				_currentMode = UpperCase;
-			else
-			{
-				_currentMode = LowerCase;
-			}
-			_altGrPressed = false;
-			_controlButtons.value(Qt::Key_Alt)->releaseKey();
-			_controlButtons.value(Qt::Key_AltGr)->releaseKey();
-			redrawKeyboard();
-			break;
-		case Qt::Key_AltGr:
-			_altGrPressed = false;
-			if(_shiftPressed)
-				_currentMode = UpperCase;
-			else
-				_currentMode = LowerCase;
-			_controlButtons.value(Qt::Key_AltGr)->releaseKey();
-			redrawKeyboard();
-			break;
-		case Qt::Key_Shift:
-			_shiftPressed = false;
-			if(_altGrPressed)
-				_currentMode = Alternate;
-			else
-				_currentMode = LowerCase;
-			_controlButtons.value(Qt::Key_Shift)->releaseKey();
-			redrawKeyboard();
-			break;
-		default: ;
-	}
-}
-
 void KeyboardView::drawKeyboard(Font *font)
 {   
     if(_currentFontName !=font->getName()) {mapKeyboardCodeValuesToFontCodes(font); _currentFontName = font->getName();}
         else charButtonView->setEnabled(false);
     }
 }
+
 void KeyboardView::redrawKeyboard()
 {
-	drawKeyboard(FontContext::instance()->getCurrentFont());
+    drawKeyboard(FontContext::instance()->getCurrentFont());
 }

File documentImageCreator/src/gui/AncientDocumentEditor/src/VirtualKeyboard/keyboardview.h

     IController * getController();
 
 public:
-	void processCharButton(QAtomicInt keyboardCode, QAtomicInt fontCode, QAtomicInt id = -1);
+    void processCharButton(QAtomicInt keyboardCode, QAtomicInt fontCode, QAtomicInt id = -1);
     void processControlButton(QAtomicInt key);
 	void processControlButtonRelease(QAtomicInt key);
 
 private:
-	void mapKeyboardCodeValuesToFontCodes(Font *font);
+    void mapKeyboardCodeValuesToFontCodes(Font *font);
     void redrawKeyboard();
     KeyboardController* _controller;
     DocumentController* _documentController;
 
 	ModeTypeEnum _currentMode ;
 	bool _ctrlPressed, _altPressed, _shiftPressed, _altGrPressed;
+
     QString _currentFontName;
 };
 

File documentImageCreator/src/gui/AncientDocumentEditor/src/VirtualKeyboard/keyboardviewxmlbuilder.h

 
 private:
 	QString _geometryXml, _charButtonsXml, _controlButtonsXml;	
+
 };
 
 #endif // KEYBORDVIEWXMLBUILDER_H

File documentImageCreator/src/gui/AncientDocumentEditor/src/application.ini

 [mainapp]
 
-fontfolder=../Resources/font/
-backgroundfolder=../Resources/background/
-xmlcheckerfolder=../Resources/xmlchecker/
+fontfolder=../../../../font/
+backgroundfolder=../../../../background/
+xmlcheckerfolder=../../../../xmlchecker/
 documentxsdchecker=document.xsd
 defaultfont=vesale 
 defaultfontextension=.of
 pagesizey=1782
 
 [keyboard]
-formatsfolder=../Resources/keyboard/
+formatsfolder=../../../../keyboard/
 defaultformat=fr_alternative.kb