void SettingsHistory::ok(){ WBSET("app/clear-search-history-on-exit", checkBox_SearchHistory->isChecked()); WBSET("app/clear-download-directories-history-on-exit", checkBox_DirectoriesHistory->isChecked()); { // memorize-tth-search-phrases WBSET("memorize-tth-search-phrases", checkBox_TTHSearchHistory->isChecked()); if (!checkBox_TTHSearchHistory->isChecked()){ QString raw = QByteArray::fromBase64(WSGET(WS_SEARCH_HISTORY).toUtf8()); QStringList searchHistory = raw.replace("\r","").split('\n', QString::SkipEmptyParts); QString text = ""; for (int k = searchHistory.count()-1; k >= 0; k--){ text = searchHistory.at(k); if (WulforUtil::isTTH(text)) searchHistory.removeAt(k); } QString hist = searchHistory.join("\n"); WSSET(WS_SEARCH_HISTORY, hist.toUtf8().toBase64()); } } { // search-history-items-number QString raw = QByteArray::fromBase64(WSGET(WS_SEARCH_HISTORY).toUtf8()); QStringList searchHistory = raw.replace("\r","").split('\n', QString::SkipEmptyParts); int maxItemsNumber = WIGET("search-history-items-number", 10); if (spinBox_SearchHistory->value() != maxItemsNumber){ maxItemsNumber = spinBox_SearchHistory->value(); WISET("search-history-items-number", maxItemsNumber); if (!searchHistory.isEmpty()){ while (searchHistory.count() > maxItemsNumber) searchHistory.removeLast(); QString hist = searchHistory.join("\n"); WSSET(WS_SEARCH_HISTORY, hist.toUtf8().toBase64()); } } } { // download-directory-history-items-number WISET("download-directory-history-items-number", spinBox_DirectoriesHistory->value()); QStringList list = DownloadToDirHistory::get(); DownloadToDirHistory::put(list); } }
void SettingsGUI::ok() { SettingsManager *SM = SettingsManager::getInstance(); { //Basic tab if (custom_style && comboBox_THEMES->currentIndex() > 0) WSSET(WS_APP_THEME, comboBox_THEMES->currentText()); else if (!comboBox_THEMES->currentIndex()) WSSET(WS_APP_THEME, ""); if (!lineEdit_APPFONT->text().isEmpty()) WSSET(WS_APP_FONT, lineEdit_APPFONT->text()); if (!lineEdit_LANGFILE->text().isEmpty() && (lineEdit_LANGFILE->text() != WSGET(WS_TRANSLATION_FILE))) WSSET(WS_TRANSLATION_FILE, lineEdit_LANGFILE->text()); WBSET(WB_MAINWINDOW_REMEMBER, radioButton_REMEMBER->isChecked()); WBSET(WB_MAINWINDOW_HIDE, radioButton_HIDE->isChecked()); if (WBGET(WB_TRAY_ENABLED) != groupBox_TRAY->isChecked()) { WBSET(WB_TRAY_ENABLED, groupBox_TRAY->isChecked()); Notify->enableTray(WBGET(WB_TRAY_ENABLED)); } if (WSGET(WS_APP_EMOTICON_THEME) != comboBox_EMOT->currentText()) { WSSET(WS_APP_EMOTICON_THEME, comboBox_EMOT->currentText()); if (EmoticonFactory::getInstance()) EmoticonFactory::getInstance()->load(); } if (comboBox_TABBAR->currentIndex() == 2) { WBSET(WB_MAINWINDOW_USE_SIDEBAR, true); WBSET(WB_MAINWINDOW_USE_M_TABBAR, false); } else if (comboBox_TABBAR->currentIndex() == 1) { WBSET(WB_MAINWINDOW_USE_SIDEBAR, false); WBSET(WB_MAINWINDOW_USE_M_TABBAR, true); } else { WBSET(WB_MAINWINDOW_USE_SIDEBAR, false); WBSET(WB_MAINWINDOW_USE_M_TABBAR, false); } WBSET("app/use-icon-theme", checkBox_ICONTHEME->isChecked()); WBSET("mainwindow/dont-show-icons-in-menus", checkBox_HIDE_ICONS_IN_MENU->isChecked()); } { //Chat tab WBSET(WB_SHOW_HIDDEN_USERS, checkBox_CHATHIDDEN->isChecked()); WBSET(WB_CHAT_SHOW_JOINS, checkBox_CHATJOINS->isChecked()); WBSET(WB_CHAT_SHOW_JOINS_FAV, checkBox_JOINSFAV->isChecked()); WBSET(WB_CHAT_REDIRECT_BOT_PMS, checkBox_REDIRECTPMBOT->isChecked()); WBSET("hubframe/redirect-pm-to-main-chat", checkBox_REDIRECT_UNREAD->isChecked()); WBSET(WB_CHAT_KEEPFOCUS, checkBox_KEEPFOCUS->isChecked()); WBSET("hubframe/unreaden-draw-line", checkBox_UNREADEN_DRAW_LINE->isChecked()); WBSET(WB_CHAT_ROTATING_MSGS, checkBox_ROTATING->isChecked()); WBSET(WB_USE_CTRL_ENTER, checkBox_USE_CTRL_ENTER->isChecked()); WBSET(WB_APP_ENABLE_EMOTICON, checkBox_EMOT->isChecked()); WBSET(WB_APP_FORCE_EMOTICONS, checkBox_EMOTFORCE->isChecked()); WBSET(WB_CHAT_USE_SMILE_PANEL, checkBox_SMILEPANEL->isChecked()); WBSET(WB_CHAT_HIDE_SMILE_PANEL, checkBox_HIDESMILEPANEL->isChecked()); } { //Chat (extended) tab WISET(WI_CHAT_DBLCLICK_ACT, comboBox_DBL_CLICK->currentIndex()); WISET(WI_CHAT_MDLCLICK_ACT, comboBox_MDL_CLICK->currentIndex()); WISET(WI_DEF_MAGNET_ACTION, comboBox_DEF_MAGNET_ACTION->currentIndex()); SM->set(SettingsManager::APP_UNIT_BASE, comboBox_APP_UNIT_BASE->currentIndex()); WBSET(WB_CHAT_HIGHLIGHT_FAVS, checkBox_HIGHLIGHTFAVS->isChecked()); SM->set(SettingsManager::USE_IP, checkBox_CHAT_SHOW_IP->isChecked()); WBSET("hubframe/use-bb-code", checkBox_BB_CODE->isChecked()); WSSET(WS_CHAT_TIMESTAMP, lineEdit_TIMESTAMP->text()); WISET(WI_OUT_IN_HIST, spinBox_OUT_IN_HIST->value()); WISET(WI_CHAT_MAXPARAGRAPHS, spinBox_PARAGRAPHS->value()); SM->set(SettingsManager::IGNORE_BOT_PMS, checkBox_IGNOREPMBOT->isChecked()); SM->set(SettingsManager::IGNORE_HUB_PMS, checkBox_IGNOREPMHUB->isChecked()); SM->set(SettingsManager::GET_USER_COUNTRY, checkBox_CHAT_SHOW_CC->isChecked()); WSSET(WS_CHAT_SEPARATOR, comboBox_CHAT_SEPARATOR->currentText()); } { //Color tab int i = 0; WSSET(WS_CHAT_LOCAL_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_OP_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_BOT_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_PRIV_LOCAL_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_PRIV_USER_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_SAY_NICK, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_STAT_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_USER_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_FAVUSER_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_TIME_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_MSG_COLOR, QColor(listWidget_CHATCOLOR->item(i++)->icon().pixmap(10, 10).toImage().pixel(0, 0)).name()); WSSET(WS_CHAT_FIND_COLOR, h_color.name()); WISET(WI_CHAT_FIND_COLOR_ALPHA, horizontalSlider_H_COLOR->value()); WSSET(WS_APP_SHARED_FILES_COLOR, shared_files_color.name()); WISET(WI_APP_SHARED_FILES_ALPHA, horizontalSlider_SHAREDFILES->value()); WBSET("hubframe/change-chat-background-color", checkBox_CHAT_BACKGROUND_COLOR->isChecked()); if (chat_background_color.isValid()) WSSET("hubframe/chat-background-color", chat_background_color.name()); if (!checkBox_CHAT_BACKGROUND_COLOR->isChecked()) WSSET("hubframe/chat-background-color", QTextEdit().palette().color(QPalette::Active, QPalette::Base).name()); if (downloads_clr.isValid()) WVSET("transferview/download-bar-color", downloads_clr); if (uploads_clr.isValid()) WVSET("transferview/upload-bar-color", uploads_clr); } WSSET(WS_SETTINGS_GUI_FONTS_STATE, tableView->horizontalHeader()->saveState().toBase64()); emit saveFonts(); }
void SettingsNotification::ok(){ {//Text WBSET(WB_NOTIFY_ENABLED, groupBox->isChecked()); WBSET(WB_NOTIFY_CH_ICON_ALWAYS, checkBox_MWVISIBLE->isChecked()); WBSET(WB_NOTIFY_SHOW_ON_ACTIVE, checkBox_MWACTIVE->isChecked()); WBSET(WB_EXIT_CONFIRM, checkBox_EXIT_CONFIRM->isChecked()); if (WBGET(WB_TRAY_ENABLED) != checkBox_TRAY->isChecked()){ WBSET(WB_TRAY_ENABLED, checkBox_TRAY->isChecked()); Notify->enableTray(WBGET(WB_TRAY_ENABLED)); } unsigned emap = 0; if (checkBox_ANY->isChecked()) emap |= Notification::ANY; if (checkBox_TRDONE->isChecked()) emap |= Notification::TRANSFER; if (checkBox_NICKSAY->isChecked()) emap |= Notification::NICKSAY; if (checkBox_PM->isChecked()) emap |= Notification::PM; WISET(WI_NOTIFY_EVENTMAP, emap); WISET(WI_NOTIFY_MODULE, comboBox->currentIndex()); Notification::getInstance()->switchModule(comboBox->currentIndex()); } {//Sound QString sounds = ""; sounds += lineEdit_SNDNICKSAY->text() + "\n"; sounds += lineEdit_SNDPM->text() + "\n"; sounds += lineEdit_SNDTRDONE->text(); WSSET(WS_NOTIFY_SOUNDS, sounds.toAscii().toBase64()); WBSET(WB_NOTIFY_SND_ENABLED, groupBox_SND->isChecked()); Notification::getInstance()->reloadSounds(); if (WBGET(WB_NOTIFY_SND_EXTERNAL)) WSSET(WS_NOTIFY_SND_CMD, lineEdit_SNDCMD->text()); unsigned emap = 0; if (groupBox_TR->isChecked()) emap |= Notification::TRANSFER; if (groupBox_NICK->isChecked()) emap |= Notification::NICKSAY; if (groupBox_PM->isChecked()) emap |= Notification::PM; WISET(WI_NOTIFY_SNDMAP, emap); } WulforSettings::getInstance()->save(); }