Changeset 359


Ignore:
Timestamp:
08/26/10 06:32:00 (18 months ago)
Author:
antonbatenev.ya.ru
Message:

Рефакторинг - частичное удаление настроек из глобальной области видимости + приведение макросов к стандартному форматированию

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/colorer.h

    r331 r359  
    5555#define COLORER_DEFAULT_NAME COLORER_HIGHLIGHT_JS_NAME 
    5656 
    57 #endif 
     57#endif   // _avalon_colorer_h_ 
  • trunk/form_main.cpp

    r358 r359  
    106106        connect(&m_timer, SIGNAL(timeout()), this, SLOT(timer_on_timer())); 
    107107 
    108         int interval = AGlobal::getInstance()->SynchronizeInterval * 1000 * 60; 
     108        int interval = synchronizeInterval(); 
    109109 
    110110        if (interval > 0) 
     
    750750 
    751751                // таймер синхронизации 
    752                 int interval = AGlobal::getInstance()->SynchronizeInterval * 1000 * 60; 
     752                QSettings settings; 
     753 
     754                int interval = synchronizeInterval(); 
    753755 
    754756                if (interval > 0) 
     
    10241026} 
    10251027//---------------------------------------------------------------------------------------------- 
     1028 
     1029int AFormMain::synchronizeInterval () 
     1030{ 
     1031        return QSettings().value("ui/synchronize_interval", "0").toUInt() * 1000 * 60; 
     1032} 
     1033//---------------------------------------------------------------------------------------------- 
  • trunk/form_main.h

    r358 r359  
    4040                 */ 
    4141                void setDefaultStatus (); 
     42 
     43                /*! 
     44                 * \brief Получение интервала периодической синхронизации 
     45                 * \return число ms между синхронизациями 
     46                 */ 
     47                int synchronizeInterval (); 
    4248 
    4349        private slots: 
  • trunk/form_main_ui.cpp

    r337 r359  
    101101        m_menu_service_settings->setMenuRole(QAction::PreferencesRole); 
    102102 
    103         #ifdef AVALON_USE_ZLIB 
     103#ifdef AVALON_USE_ZLIB 
    104104        m_menu_service->addSeparator(); 
    105105 
     
    112112        m_menu_service_storage_uncompress = m_menu_service_storage->addAction(QString::fromUtf8("Распаковать тела сообщений")); 
    113113        m_menu_service_storage_uncompress->setIcon(QIcon(":/icons/compress16.png")); 
    114         #endif 
     114#endif 
    115115 
    116116        // меню "?" 
  • trunk/form_main_ui.h

    r246 r359  
    7171                QAction*        m_menu_service_subscribe;              /*!< \brief Сервис / Подписка на форумы                    */ 
    7272                QAction*        m_menu_service_settings;               /*!< \brief Сервис / Настройка                             */ 
    73                 #ifdef AVALON_USE_ZLIB 
     73#ifdef AVALON_USE_ZLIB 
    7474                QMenu*          m_menu_service_storage;                /*!< \brief Сервис / Хранилище                             */ 
    7575                QAction*           m_menu_service_storage_compress;    /*!< \brief Сервис / Хранилище / Упаковать                 */ 
    7676                QAction*           m_menu_service_storage_uncompress;  /*!< \brief Сервис / Хранилище / Распаковать               */ 
    77                 #endif 
     77#endif 
    7878                QMenu*       m_menu_q;                                 /*!< \brief ? / ... */ 
    7979                QAction*        m_menu_q_yandex_url;                   /*!< \brief ? / URL Яндекс         */ 
     
    107107}; 
    108108 
    109 #endif 
     109#endif   // _avalon_form_main_ui_h_ 
  • trunk/global.cpp

    r358 r359  
    4646        QSettings settings; 
    4747 
    48         // простые настройки 
    49         MarkAsReadTimer     = settings.value("ui/mark_as_read_timer",   "1500").toUInt(); 
    50         MaxTopicToShow      = settings.value("ui/max_topic_to_show",    "0"   ).toUInt(); 
    51         SynchronizeInterval = settings.value("ui/synchronize_interval", "0"   ).toUInt(); 
    52  
    53         #ifdef AVALON_USE_ZLIB 
    54         Compression         = settings.value("storage/compression", false).toInt(); 
    55         #endif 
    56  
    57         #ifdef AVALON_USE_ASPELL 
    58         SpellChecker        = settings.value("ui/spellchecker", true).toInt(); 
    59         #endif 
     48#ifdef AVALON_USE_ZLIB 
     49        Compression = settings.value("storage/compression", false).toInt(); 
     50#endif 
    6051 
    6152        // установка колорера для подсветки синтаксиса 
    62         QString colorer = settings.value("ui/colorer", COLORER_GNU_SOURCE_HIGHLIGHT_NAME).toString(); 
     53        QString colorer = settings.value("ui/colorer", COLORER_DEFAULT_NAME).toString(); 
    6354 
    6455        if (colorer == COLORER_ENSCRIPT_NAME) 
  • trunk/global.h

    r304 r359  
    3838                void reload (); 
    3939 
    40                 int       MarkAsReadTimer;     /*!< \brief Время на пометку сообщения как прочитанного (ms) */ 
    41                 int       MaxTopicToShow;      /*!< \brief Максимальное количество топиков для отображения  */ 
    42                 int       SynchronizeInterval; /*!< \brief Интервал синхронизации (минут)                   */ 
    43                 AColorer  Colorer;             /*!< \brief Движок подсветки синтаксиса                      */ 
     40                // 
     41                // Общие переменные 
     42                // 
    4443 
    45                 #ifdef AVALON_USE_ZLIB 
    46                 bool      Compression;         /*!< \brief Сжатие тел сообщений                             */ 
    47                 #endif 
    48  
    49                 #ifdef AVALON_USE_ASPELL 
    50                 bool      SpellChecker;        /*!< \brief Проверка орфографии                              */ 
    51                 #endif 
    52  
    53                 AUserInfo Me;                  /*!< \brief Текущий пользователь avalon                      */ 
     44                AUserInfo Me;          /*!< \brief Текущий пользователь avalon */ 
     45                AColorer  Colorer;     /*!< \brief Движок подсветки синтаксиса */ 
     46#ifdef AVALON_USE_ZLIB 
     47                bool      Compression; /*!< \brief Сжатие тел сообщений        */ 
     48#endif 
    5449 
    5550                // 
    56                 // Константы 
     51                // Константы форматирования 
    5752                // 
    5853 
     
    7166}; 
    7267 
    73 #endif 
     68#endif   // _avalon_global_h_ 
  • trunk/message_tree.cpp

    r348 r359  
    4646        m_current_forum.RateLimit = 0; 
    4747 
     48        m_max_topic_to_show  = 0; 
     49        m_mark_as_read_timer = 500; 
     50 
    4851        // 
    4952        // инициализация GUI виджета 
    5053        // 
    5154 
    52         #ifndef Q_WS_WIN 
    53                 setFrameShadow(QFrame::Plain); 
    54         #endif 
     55#ifndef Q_WS_WIN 
     56        setFrameShadow(QFrame::Plain); 
     57#endif 
    5558 
    5659        setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 
     
    325328{ 
    326329        // 
     330        // перезагрузка настроек 
     331        // 
     332        QSettings settings; 
     333 
     334        m_max_topic_to_show  = settings.value("ui/max_topic_to_show",  "0").toUInt(); 
     335        m_mark_as_read_timer = settings.value("ui/mark_as_read_timer", "500").toUInt(); 
     336 
     337        // 
    327338        // базовая очистка 
    328339        // 
     
    396407                QList<int> topic_list; 
    397408 
    398                 if (storage->getForumTopicList(m_current_forum.ID, AGlobal::getInstance()->MaxTopicToShow, topic_list, NULL) == false) 
     409                if (storage->getForumTopicList(m_current_forum.ID, m_max_topic_to_show, topic_list, NULL) == false) 
    399410                { 
    400411                        storage->showError(m_parent); 
     
    859870        if (info->IsRead == false) 
    860871        { 
    861                 int interval = AGlobal::getInstance()->MarkAsReadTimer; 
    862  
    863                 if (interval > 0) 
    864                         m_timer.start(interval); 
     872                if (m_mark_as_read_timer > 0) 
     873                        m_timer.start(m_mark_as_read_timer); 
    865874                else 
    866875                        m_timer.stop(); 
     
    18981907        QList<int> list; 
    18991908 
    1900         if (storage->getMyMessageList(AGlobal::getInstance()->Me.ID, AGlobal::getInstance()->MaxTopicToShow, list, NULL) == false) 
     1909        if (storage->getMyMessageList(AGlobal::getInstance()->Me.ID, m_max_topic_to_show, list, NULL) == false) 
    19011910        { 
    19021911                storage->showError(m_parent); 
     
    19311940        } 
    19321941 
     1942 
    19331943        QList<int> list; 
    19341944 
    1935         if (storage->getAnswers2MeList(AGlobal::getInstance()->Me.ID, AGlobal::getInstance()->MaxTopicToShow, list, NULL) == false) 
     1945        if (storage->getAnswers2MeList(AGlobal::getInstance()->Me.ID, m_max_topic_to_show, list, NULL) == false) 
    19361946        { 
    19371947                storage->showError(m_parent); 
  • trunk/message_tree.h

    r272 r359  
    137137                // 
    138138 
    139                 AForumInfo m_current_forum; /*!< \brief Текущий отображаемый форум  */ 
    140  
    141                 QList<int> m_history;       /*!< \brief Список с ID просмотренных сообщений для навигации вперед/назад */ 
    142                 int        m_history_index; /*!< \brief Текущий индекс в списке истории                                */ 
     139                AForumInfo m_current_forum;      /*!< \brief Текущий отображаемый форум                                     */ 
     140 
     141                QList<int> m_history;            /*!< \brief Список с ID просмотренных сообщений для навигации вперед/назад */ 
     142                int        m_history_index;      /*!< \brief Текущий индекс в списке истории                                */ 
     143 
     144                int        m_max_topic_to_show;  /*!< \brief Максимальное количество топиков для отображения                */ 
     145                int        m_mark_as_read_timer; /*!< \brief Время на пометку сообщения как прочитанного (ms)               */ 
    143146 
    144147                /*! 
     
    310313}; 
    311314 
    312 #endif 
     315#endif   // _avalon_message_tree_h_ 
  • trunk/spell_edit.cpp

    r267 r359  
    55// $URL$ 
    66//---------------------------------------------------------------------------------------------- 
    7 #include "global.h" 
    87#include "spell_edit.h" 
    98//---------------------------------------------------------------------------------------------- 
     
    1514        m_spellchecker = NULL; 
    1615 
    17         if (AGlobal::getInstance()->SpellChecker == true) 
     16        if (QSettings().value("ui/spellchecker", true).toInt() == true) 
    1817                m_spellchecker = new ASpellChecker(document()); 
    1918} 
     
    8281} 
    8382//---------------------------------------------------------------------------------------------- 
    84 #endif // AVALON_USE_ASPELL 
     83#endif   // AVALON_USE_ASPELL 
    8584//---------------------------------------------------------------------------------------------- 
  • trunk/spell_edit.h

    r267 r359  
    6464}; 
    6565 
    66 #else // AVALON_USE_ASPELL 
     66#else   // AVALON_USE_ASPELL 
    6767 
    6868/*! 
     
    7171typedef QTextEdit ASpellTextEdit; 
    7272 
    73 #endif // AVALON_USE_ASPELL 
     73#endif   // AVALON_USE_ASPELL 
    7474 
    75 #endif 
     75#endif   // _avalon_spell_edit_h_ 
  • trunk/version.h

    r357 r359  
    2020 * \brief Дата билда (заменяется автоматически при каждом билде в version.h, что и приводит к смене номера ревизии) 
    2121 */ 
    22 #define AVALON_DATE "Срд Авг 25 23:50:56 MSD 2010" 
     22#define AVALON_DATE "Чтв Авг 26 06:28:22 MSD 2010" 
    2323 
    2424#endif 
Note: See TracChangeset for help on using the changeset viewer.