Changeset 262
- Timestamp:
- 07/13/09 20:46:26 (3 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
dev/avalon.mysql.000.sql (modified) (1 diff)
-
dev/build.sh (modified) (2 diffs)
-
form_message.cpp (modified) (4 diffs)
-
form_message.h (modified) (2 diffs)
-
sysheaders.h (modified) (1 diff)
-
version.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dev/avalon.mysql.000.sql
r214 r262 43 43 ( 44 44 'version', 45 'v1.0rc 1, patch avalon.000.sql'45 'v1.0rc2, patch avalon.000.sql' 46 46 ); 47 47 -
trunk/dev/build.sh
r248 r262 55 55 fi 56 56 57 ${QT_PATH}/bin/qmake -project -recursive -Wall -o ${PROJECT_NAME}.pro "QT += network sql webkit" "CONFIG += debug" 57 ${QT_PATH}/bin/qmake -project -recursive -Wall -o ${PROJECT_NAME}.pro "QT += network sql webkit" "CONFIG += debug" "LIBS += -laspell" 58 58 59 59 touch "debug.out" … … 66 66 fi 67 67 68 ${QT_PATH}/bin/qmake -project -recursive -Wall -o ${PROJECT_NAME}.pro "QT += network sql webkit" 68 ${QT_PATH}/bin/qmake -project -recursive -Wall -o ${PROJECT_NAME}.pro "QT += network sql webkit" "LIBS += -laspell" 69 69 70 70 touch "release.out" -
trunk/form_message.cpp
r247 r262 14 14 FormMessage::FormMessage (QWidget* parent, bool is_reply, const AMessageInfoGUI& info, int edit_id) : FormMessageUI (parent) 15 15 { 16 #ifdef AVALON_USE_ASPELL 17 18 m_aspell_speller_en = NULL; 19 m_aspell_speller_ru = NULL; 20 21 m_aspell_config_en = new_aspell_config(); 22 m_aspell_config_ru = NULL; 23 24 if (m_aspell_config_en != NULL) 25 { 26 // 27 // спеллер английского языка 28 // 29 30 bool fail = false; 31 32 if (aspell_config_replace(m_aspell_config_en, "lang", "en_US") == FALSE) 33 { 34 QMessageBox::critical(parent, QString::fromUtf8("Ошибка!"), QString("Aspell error: ") + QString(aspell_config_error_message(m_aspell_config_en))); 35 fail = true; 36 } 37 38 if (fail == false && aspell_config_replace(m_aspell_config_en, "encoding", "utf-8") == FALSE) 39 { 40 QMessageBox::critical(parent, QString::fromUtf8("Ошибка!"), QString("Aspell error: ") + QString(aspell_config_error_message(m_aspell_config_en))); 41 fail = true; 42 } 43 44 if (fail == false) 45 { 46 AspellCanHaveError* possible_err = new_aspell_speller(m_aspell_config_en); 47 48 if (aspell_error_number(possible_err) != 0) 49 { 50 QMessageBox::critical(parent, QString::fromUtf8("Ошибка!"), QString("Aspell error: ") + QString(aspell_error_message(possible_err))); 51 fail = true; 52 } 53 else 54 m_aspell_speller_en = to_aspell_speller(possible_err); 55 } 56 57 // 58 // Спеллер русского языка 59 // 60 61 if (fail == false) 62 { 63 m_aspell_config_ru = aspell_config_clone(m_aspell_config_en); 64 65 if (m_aspell_config_ru != NULL) 66 { 67 if (aspell_config_replace(m_aspell_config_ru, "lang", "ru_RU") == FALSE) 68 { 69 QMessageBox::critical(parent, QString::fromUtf8("Ошибка!"), QString("Aspell error: ") + QString(aspell_config_error_message(m_aspell_config_ru))); 70 fail = true; 71 } 72 73 if (fail == false && aspell_config_replace(m_aspell_config_ru, "encoding", "utf-8") == FALSE) 74 { 75 QMessageBox::critical(parent, QString::fromUtf8("Ошибка!"), QString("Aspell error: ") + QString(aspell_config_error_message(m_aspell_config_ru))); 76 fail = true; 77 } 78 79 if (fail == false) 80 { 81 AspellCanHaveError* possible_err = new_aspell_speller(m_aspell_config_ru); 82 83 if (aspell_error_number(possible_err) != 0) 84 { 85 QMessageBox::critical(parent, QString::fromUtf8("Ошибка!"), QString("Aspell error: ") + QString(aspell_error_message(possible_err))); 86 fail = true; 87 } 88 else 89 m_aspell_speller_ru = to_aspell_speller(possible_err); 90 } 91 92 } // if (m_aspell_config_ru != NULL) 93 94 } // if (fail == false) 95 96 } // if (m_aspell_config_en != NULL) 97 98 #endif // #ifdef AVALON_USE_ASPELL 99 16 100 if (edit_id != 0) 17 101 is_reply = false; … … 147 231 connect(m_text_subject, SIGNAL(textChanged(const QString&)), this, SLOT(text_subject_text_changed(const QString&))); 148 232 connect(m_tab_message, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int))); 233 234 #ifdef AVALON_USE_ASPELL 235 236 m_aspell_timer = NULL; 237 238 if (m_aspell_speller_en != NULL && m_aspell_speller_ru != NULL) 239 { 240 m_aspell_timer = new QTimer(this); 241 m_aspell_timer->setInterval(1000); 242 m_aspell_timer->setSingleShot(true); 243 244 connect(m_aspell_timer, SIGNAL(timeout()), this, SLOT(aspell_timer_on_timer())); 245 connect(m_text_source, SIGNAL(textChanged()), this, SLOT(text_source_text_changed())); 246 } 247 248 #endif 149 249 } 150 250 //---------------------------------------------------------------------------------------------- … … 152 252 FormMessage::~FormMessage () 153 253 { 254 #ifdef AVALON_USE_ASPELL 255 delete_aspell_speller(m_aspell_speller_en); 256 delete_aspell_speller(m_aspell_speller_ru); 257 delete_aspell_config(m_aspell_config_en); 258 delete_aspell_config(m_aspell_config_ru); 259 #endif 154 260 } 155 261 //---------------------------------------------------------------------------------------------- … … 307 413 } 308 414 //---------------------------------------------------------------------------------------------- 415 416 #ifdef AVALON_USE_ASPELL 417 void FormMessage::text_source_text_changed () 418 { 419 if (m_aspell_timer != NULL) 420 { 421 m_aspell_timer->stop(); 422 m_aspell_timer->start(); 423 } 424 } 425 #endif 426 //---------------------------------------------------------------------------------------------- 427 428 #ifdef AVALON_USE_ASPELL 429 void FormMessage::aspell_timer_on_timer () 430 { 431 /* 432 QString text = m_text_source->toPlainText(); 433 434 QRegExp word_regexp("(\\c+|(\\c+\\-\\c+))"); 435 436 int pos = 0; 437 438 while ((pos = word_regexp.indexIn(text, pos)) != -1) 439 { 440 int len = word_regexp.matchedLength(); 441 QString word = text.mid(pos, len); 442 pos += len; 443 444 DEBUG_MSG(word); 445 } 446 */ 447 448 /* 449 QString text = m_text_source->toPlainText(); 450 QString word = ""; 451 452 for (int i = 0; i < text.length(); i++) 453 { 454 QChar ch = text[i]; 455 456 if (ch == ' ' || ch == '\n') 457 { 458 if (word.length() > 0) 459 { 460 QByteArray data = word.toUtf8(); 461 462 int correct = aspell_speller_check(m_aspell_speller, data.data(), data.length()); 463 464 if (correct == -1) 465 { 466 unsigned int err_num = aspell_speller_error_number(m_aspell_speller); 467 const char* err_msg = aspell_speller_error_message(m_aspell_speller); 468 469 QString error = QString("Aspell error: [") + QString::number(err_num) + "] " + QString(err_msg); 470 471 QMessageBox::critical(this, QString::fromUtf8("Ошибка!"), error); 472 } 473 else 474 { 475 QString result; 476 if (correct == 1) 477 result = word + " - OK"; 478 else 479 result = word + " - Error"; 480 DEBUG_MSG(result); 481 //QTextCursor cursor = 482 } 483 484 word = ""; 485 } 486 } 487 else 488 word = word + ch; 489 } 490 491 QTextCharFormat char_format = m_text_source->currentCharFormat(); 492 char_format.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline); 493 char_format.setUnderlineColor(Qt::red); 494 m_text_source->setCurrentCharFormat(char_format); 495 */ 496 } 497 #endif 498 //---------------------------------------------------------------------------------------------- -
trunk/form_message.h
r207 r262 67 67 int m_edit_id; 68 68 69 #ifdef AVALON_USE_ASPELL 70 71 AspellConfig* m_aspell_config_en; /*!< \brief Конфиг aspell для проверки английского */ 72 AspellConfig* m_aspell_config_ru; /*!< \brief Конфиг aspell для проверки русского */ 73 74 AspellSpeller* m_aspell_speller_en; /*!< \brief Спеллер aspell для проверки английского */ 75 AspellSpeller* m_aspell_speller_ru; /*!< \brief Спеллер aspell для проверки русского */ 76 77 QTimer* m_aspell_timer; /*!< \brief Таймер для проверки (чтобы не грузить) */ 78 79 #endif 80 69 81 /*! 70 82 * \brief Событие закрытия формы (см. Qt::QDialog). … … 100 112 void text_subject_text_changed (const QString& text); 101 113 114 #ifdef AVALON_USE_ASPELL 115 /*! 116 * \brief Смена текста 117 */ 118 void text_source_text_changed (); 119 120 /*! 121 * \brief Таймер проверки 122 */ 123 void aspell_timer_on_timer (); 124 #endif 125 102 126 /*! 103 127 * \brief Событие клика по линку -
trunk/sysheaders.h
r258 r262 80 80 // возможность сжатия тел сообщений 81 81 #define AVALON_USE_ZLIB 82 83 82 #ifdef AVALON_USE_ZLIB 84 83 #include <zlib.h> 85 84 #endif 86 85 86 // проверка орфографии 87 #define AVALON_USE_ASPELL 88 #ifdef AVALON_USE_ASPELL 89 #include <aspell.h> 90 #endif 91 87 92 /*! 88 93 * \brief Получение строки версии (см. version.cpp) 89 * \return Строка версии вида "avalon 1.0 brev NNN"94 * \return Строка версии вида "avalon 1.0rc2 rev NNN" 90 95 */ 91 96 QString getVersionString (); -
trunk/version.h
r261 r262 20 20 * \brief Дата билда (заменяется автоматически при каждом билде в version.h, что и приводит к смене номера ревизии) 21 21 */ 22 #define AVALON_DATE "Пнд Июл 13 16:37:12MSD 2009"22 #define AVALON_DATE "Пнд Июл 13 20:44:51 MSD 2009" 23 23 24 24 #endif
Note: See TracChangeset
for help on using the changeset viewer.
