| 1 | // -*- c-basic-offset: 2 -*- |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of Licq, an instant messaging client for UNIX. |
|---|
| 4 | * Copyright (C) 2007 Licq developers |
|---|
| 5 | * |
|---|
| 6 | * Licq is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * Licq is distributed in the hope that it will be useful, |
|---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | * GNU General Public License for more details. |
|---|
| 15 | * |
|---|
| 16 | * You should have received a copy of the GNU General Public License |
|---|
| 17 | * along with Licq; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #include "contactlist.h" |
|---|
| 22 | |
|---|
| 23 | #include "config.h" |
|---|
| 24 | |
|---|
| 25 | #include <QCheckBox> |
|---|
| 26 | #include <QComboBox> |
|---|
| 27 | #include <QGridLayout> |
|---|
| 28 | #include <QGroupBox> |
|---|
| 29 | #include <QHBoxLayout> |
|---|
| 30 | #include <QIntValidator> |
|---|
| 31 | #include <QLabel> |
|---|
| 32 | #include <QLineEdit> |
|---|
| 33 | #include <QRadioButton> |
|---|
| 34 | #include <QSpinBox> |
|---|
| 35 | #include <QVBoxLayout> |
|---|
| 36 | |
|---|
| 37 | #include <licq_icqd.h> |
|---|
| 38 | |
|---|
| 39 | #include "config/chat.h" |
|---|
| 40 | #include "config/contactlist.h" |
|---|
| 41 | #include "config/general.h" |
|---|
| 42 | #include "config/skin.h" |
|---|
| 43 | |
|---|
| 44 | #include "core/mainwin.h" |
|---|
| 45 | |
|---|
| 46 | #include "settingsdlg.h" |
|---|
| 47 | |
|---|
| 48 | using namespace LicqQtGui; |
|---|
| 49 | /* TRANSLATOR LicqQtGui::Settings::ContactList */ |
|---|
| 50 | |
|---|
| 51 | Settings::ContactList::ContactList(SettingsDlg* parent) |
|---|
| 52 | : QObject(parent) |
|---|
| 53 | { |
|---|
| 54 | parent->addPage(SettingsDlg::ContactListPage, createPageContactList(parent), |
|---|
| 55 | tr("Contact List")); |
|---|
| 56 | parent->addPage(SettingsDlg::ColumnsPage, createPageColumns(parent), |
|---|
| 57 | tr("Columns"), SettingsDlg::ContactListPage); |
|---|
| 58 | parent->addPage(SettingsDlg::ContactInfoPage, createPageContactInfo(parent), |
|---|
| 59 | tr("Contact Info"), SettingsDlg::ContactListPage); |
|---|
| 60 | |
|---|
| 61 | load(); |
|---|
| 62 | } |
|---|
| 63 | |
|---|
| 64 | QWidget* Settings::ContactList::createPageContactList(QWidget* parent) |
|---|
| 65 | { |
|---|
| 66 | QWidget* w = new QWidget(parent); |
|---|
| 67 | myPageContactListLayout = new QVBoxLayout(w); |
|---|
| 68 | myPageContactListLayout->setContentsMargins(0, 0, 0, 0); |
|---|
| 69 | |
|---|
| 70 | myAppearanceBox = new QGroupBox(tr("Contact List Appearance")); |
|---|
| 71 | myAppearanceLayout = new QGridLayout(myAppearanceBox); |
|---|
| 72 | |
|---|
| 73 | myGridLinesCheck = new QCheckBox(tr("Show grid lines")); |
|---|
| 74 | myGridLinesCheck->setToolTip(tr("Draw the box around each square in the user list")); |
|---|
| 75 | myAppearanceLayout->addWidget(myGridLinesCheck, 0, 0); |
|---|
| 76 | |
|---|
| 77 | myHeaderCheck = new QCheckBox(tr("Show column headers")); |
|---|
| 78 | myHeaderCheck->setToolTip(tr("Turns on or off the display of headers above each column in the user list")); |
|---|
| 79 | myAppearanceLayout->addWidget(myHeaderCheck, 1, 0); |
|---|
| 80 | |
|---|
| 81 | myShowDividersCheck = new QCheckBox(tr("Show user dividers")); |
|---|
| 82 | myShowDividersCheck->setToolTip(tr("Show the \"--online--\" and \"--offline--\" bars in the contact list")); |
|---|
| 83 | myAppearanceLayout->addWidget(myShowDividersCheck, 2, 0); |
|---|
| 84 | |
|---|
| 85 | myFontStylesCheck = new QCheckBox(tr("Use font styles")); |
|---|
| 86 | myFontStylesCheck->setToolTip(tr("Use italics and bold in the user list to " |
|---|
| 87 | "indicate special characteristics such as online notify and visible list")); |
|---|
| 88 | myAppearanceLayout->addWidget(myFontStylesCheck, 3, 0); |
|---|
| 89 | |
|---|
| 90 | myShowExtIconsCheck = new QCheckBox(tr("Show extended icons")); |
|---|
| 91 | myShowExtIconsCheck->setToolTip(tr("Show birthday, invisible, and custom auto response icons to the right of users in the list")); |
|---|
| 92 | myAppearanceLayout->addWidget(myShowExtIconsCheck, 4, 0); |
|---|
| 93 | |
|---|
| 94 | myShowPhoneIconsCheck = new QCheckBox(tr("Show phone icons")); |
|---|
| 95 | myShowPhoneIconsCheck->setToolTip(tr("Show extended icons for phone statuses")); |
|---|
| 96 | connect(myShowExtIconsCheck, SIGNAL(toggled(bool)), |
|---|
| 97 | myShowPhoneIconsCheck, SLOT(setEnabled(bool))); |
|---|
| 98 | myAppearanceLayout->addWidget(myShowPhoneIconsCheck, 5, 0); |
|---|
| 99 | |
|---|
| 100 | myShowUserIconsCheck = new QCheckBox(tr("Show user display picture")); |
|---|
| 101 | myShowUserIconsCheck->setToolTip(tr("Show the user's display picture" |
|---|
| 102 | " instead of a status icon, if the user" |
|---|
| 103 | " is online and has a display picture")); |
|---|
| 104 | myAppearanceLayout->addWidget(myShowUserIconsCheck, 6, 0); |
|---|
| 105 | |
|---|
| 106 | myAlwaysShowONUCheck = new QCheckBox(tr("Always show online notify users")); |
|---|
| 107 | myAlwaysShowONUCheck->setToolTip(tr("Show online notify users who are offline even when offline users are hidden.")); |
|---|
| 108 | myAppearanceLayout->addWidget(myAlwaysShowONUCheck, 0, 1); |
|---|
| 109 | |
|---|
| 110 | myTransparentCheck = new QCheckBox(tr("Transparent when possible")); |
|---|
| 111 | myTransparentCheck->setToolTip(tr("Make the user window transparent when there is no scroll bar")); |
|---|
| 112 | myAppearanceLayout->addWidget(myTransparentCheck, 1, 1); |
|---|
| 113 | |
|---|
| 114 | myShowGroupIfNoMsgCheck = new QCheckBox(tr("Show group name if no messages")); |
|---|
| 115 | myShowGroupIfNoMsgCheck->setToolTip(tr("Show the name of the current group in the messages label when there are no new messages")); |
|---|
| 116 | myAppearanceLayout->addWidget(myShowGroupIfNoMsgCheck, 2, 1); |
|---|
| 117 | |
|---|
| 118 | mySysBackCheck = new QCheckBox(tr("Use system background color")); |
|---|
| 119 | myAppearanceLayout->addWidget(mySysBackCheck, 3, 1); |
|---|
| 120 | |
|---|
| 121 | myScrollBarCheck = new QCheckBox(tr("Allow scroll bar")); |
|---|
| 122 | myScrollBarCheck->setToolTip(tr("Allow the vertical scroll bar in the user list")); |
|---|
| 123 | myAppearanceLayout->addWidget(myScrollBarCheck, 4, 1); |
|---|
| 124 | |
|---|
| 125 | QHBoxLayout* myFrameStyleLayout = new QHBoxLayout(); |
|---|
| 126 | myFrameStyleLabel = new QLabel(tr("Frame style:")); |
|---|
| 127 | myFrameStyleLayout->addWidget(myFrameStyleLabel); |
|---|
| 128 | myFrameStyleLabel->setToolTip(tr("Override the skin setting for the frame style of the user window:\n" |
|---|
| 129 | " 0 (No frame), 1 (Box), 2 (Panel), 3 (WinPanel)\n" |
|---|
| 130 | " + 16 (Plain), 32 (Raised), 48 (Sunken), 240 (Shadow)")); |
|---|
| 131 | myFrameStyleEdit = new QLineEdit(); |
|---|
| 132 | myFrameStyleEdit->setValidator(new QIntValidator(myFrameStyleEdit)); |
|---|
| 133 | myFrameStyleEdit->setToolTip(myFrameStyleLabel->toolTip()); |
|---|
| 134 | myFrameStyleLabel->setBuddy(myFrameStyleEdit); |
|---|
| 135 | myFrameStyleLayout->addWidget(myFrameStyleEdit); |
|---|
| 136 | myAppearanceLayout->addLayout(myFrameStyleLayout, 5, 1); |
|---|
| 137 | |
|---|
| 138 | // Make the columns evenly wide, otherwise the QLineEdit steals the space |
|---|
| 139 | myAppearanceLayout->setColumnStretch(0, 1); |
|---|
| 140 | myAppearanceLayout->setColumnStretch(1, 1); |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | myBehaviourBox = new QGroupBox(tr("Contact List Behaviour")); |
|---|
| 144 | myBehaviourLayout = new QGridLayout(myBehaviourBox); |
|---|
| 145 | |
|---|
| 146 | mySSListCheck = new QCheckBox(tr("Use server side contact list")); |
|---|
| 147 | mySSListCheck->setToolTip(tr("Store your contacts on the server so they are accessible from different locations and/or programs")); |
|---|
| 148 | myBehaviourLayout->addWidget(mySSListCheck, 0, 0); |
|---|
| 149 | |
|---|
| 150 | myManualNewUserCheck = new QCheckBox(tr("Manual \"New User\" group handling")); |
|---|
| 151 | myManualNewUserCheck->setToolTip(tr("If not checked, a user will be automatically removed from " |
|---|
| 152 | "\"New User\" group when you first send an event to them.")); |
|---|
| 153 | myBehaviourLayout->addWidget(myManualNewUserCheck, 1, 0); |
|---|
| 154 | |
|---|
| 155 | myEnableMainwinMouseMovementCheck = new QCheckBox(tr("Allow dragging main window")); |
|---|
| 156 | myEnableMainwinMouseMovementCheck->setToolTip(tr("Lets you drag around the main window with your mouse")); |
|---|
| 157 | myBehaviourLayout->addWidget(myEnableMainwinMouseMovementCheck, 2, 0); |
|---|
| 158 | |
|---|
| 159 | myMainWinStickyCheck = new QCheckBox(tr("Sticky main window")); |
|---|
| 160 | myMainWinStickyCheck->setToolTip(tr("Makes the Main window visible on all desktops")); |
|---|
| 161 | myBehaviourLayout->addWidget(myMainWinStickyCheck, 0, 1); |
|---|
| 162 | |
|---|
| 163 | myDragMovesUserCheck = new QCheckBox(tr("Move users when dragging to groups")); |
|---|
| 164 | myDragMovesUserCheck->setToolTip(tr("If checked a user will be moved when dragged to another group.\n" |
|---|
| 165 | "If not checked user will only be added to the new group.")); |
|---|
| 166 | myBehaviourLayout->addWidget(myDragMovesUserCheck, 1, 1); |
|---|
| 167 | |
|---|
| 168 | QHBoxLayout* mySortByLayout = new QHBoxLayout(); |
|---|
| 169 | mySortByLabel = new QLabel(tr("Additional sorting:")); |
|---|
| 170 | mySortByLabel->setToolTip(tr("<b>none:</b> - Don't sort online users by Status<br>\n" |
|---|
| 171 | "<b>status</b> - Sort online users by status<br>\n" |
|---|
| 172 | "<b>status + last event</b> - Sort online users by status and by last event<br>\n" |
|---|
| 173 | "<b>status + new messages</b> - Sort online users by status and number of new messages")); |
|---|
| 174 | mySortByLayout->addWidget(mySortByLabel); |
|---|
| 175 | mySortByCombo = new QComboBox(); |
|---|
| 176 | mySortByCombo->addItem(tr("none"), 0); |
|---|
| 177 | mySortByCombo->addItem(tr("status"), 1); |
|---|
| 178 | mySortByCombo->addItem(tr("status + last event"), 2); |
|---|
| 179 | mySortByCombo->addItem(tr("status + new messages"), 3); |
|---|
| 180 | mySortByCombo->setToolTip(mySortByLabel->toolTip()); |
|---|
| 181 | mySortByLabel->setBuddy(mySortByCombo); |
|---|
| 182 | mySortByLayout->addWidget(mySortByCombo); |
|---|
| 183 | myBehaviourLayout->addLayout(mySortByLayout, 2, 1); |
|---|
| 184 | |
|---|
| 185 | |
|---|
| 186 | myPageContactListLayout->addWidget(myAppearanceBox); |
|---|
| 187 | myPageContactListLayout->addWidget(myBehaviourBox); |
|---|
| 188 | myPageContactListLayout->addStretch(1); |
|---|
| 189 | |
|---|
| 190 | return w; |
|---|
| 191 | } |
|---|
| 192 | |
|---|
| 193 | QWidget* Settings::ContactList::createPageColumns(QWidget* parent) |
|---|
| 194 | { |
|---|
| 195 | QWidget* w = new QWidget(parent); |
|---|
| 196 | myPageColumnsLayout = new QVBoxLayout(w); |
|---|
| 197 | myPageColumnsLayout->setContentsMargins(0, 0, 0, 0); |
|---|
| 198 | |
|---|
| 199 | myColumnsBox = new QGroupBox (tr("Column Configuration")); |
|---|
| 200 | myColumnsLayout = new QGridLayout(myColumnsBox); |
|---|
| 201 | |
|---|
| 202 | // Headings |
|---|
| 203 | myColTitleLabel = new QLabel (tr("Title")); |
|---|
| 204 | myColTitleLabel->setToolTip(tr("The string which will appear in the column header")); |
|---|
| 205 | myColumnsLayout->addWidget(myColTitleLabel, 0, 1); |
|---|
| 206 | myColFormatLabel = new QLabel (tr("Format")); |
|---|
| 207 | myColFormatLabel->setToolTip(tr("The format string used to define what will appear in each column.<br>" |
|---|
| 208 | "The following parameters can be used:") |
|---|
| 209 | + gMainWindow->usprintfHelp); |
|---|
| 210 | myColumnsLayout->addWidget(myColFormatLabel, 0, 2); |
|---|
| 211 | myColWidthLabel = new QLabel (tr("Width")); |
|---|
| 212 | myColWidthLabel->setToolTip(tr("The width of the column")); |
|---|
| 213 | myColumnsLayout->addWidget(myColWidthLabel, 0, 3); |
|---|
| 214 | myColAlignLabel = new QLabel(tr("Alignment")); |
|---|
| 215 | myColAlignLabel->setToolTip(tr("The alignment of the column")); |
|---|
| 216 | myColumnsLayout->addWidget(myColAlignLabel, 0, 4); |
|---|
| 217 | |
|---|
| 218 | for (unsigned short i = 0; i < MAX_COLUMNCOUNT; i++) |
|---|
| 219 | { |
|---|
| 220 | myColNumberRadio[i] = new QRadioButton(QString::number(i+1)); |
|---|
| 221 | myColNumberRadio[i]->setToolTip(tr("Number of columns")); |
|---|
| 222 | connect(myColNumberRadio[i], SIGNAL(toggled(bool)), SLOT(numColumnsChanged())); |
|---|
| 223 | myColumnsLayout->addWidget(myColNumberRadio[i], i+1, 0); |
|---|
| 224 | |
|---|
| 225 | myColTitleEdit[i] = new QLineEdit(); |
|---|
| 226 | myColTitleEdit[i]->setToolTip(myColTitleLabel->toolTip()); |
|---|
| 227 | myColumnsLayout->addWidget(myColTitleEdit[i], i+1, 1); |
|---|
| 228 | |
|---|
| 229 | myColFormatEdit[i] = new QLineEdit(); |
|---|
| 230 | myColFormatEdit[i]->setToolTip(myColFormatLabel->toolTip()); |
|---|
| 231 | myColumnsLayout->addWidget(myColFormatEdit[i], i+1, 2); |
|---|
| 232 | |
|---|
| 233 | myColWidthSpin[i] = new QSpinBox(); |
|---|
| 234 | myColWidthSpin[i]->setToolTip(myColWidthLabel->toolTip()); |
|---|
| 235 | myColWidthSpin[i]->setRange(0, 2048); |
|---|
| 236 | myColumnsLayout->addWidget(myColWidthSpin[i], i+1, 3); |
|---|
| 237 | |
|---|
| 238 | myColAlignCombo[i] = new QComboBox(); |
|---|
| 239 | myColAlignCombo[i]->setToolTip(myColAlignLabel->toolTip()); |
|---|
| 240 | myColAlignCombo[i]->addItem(tr("Left")); |
|---|
| 241 | myColAlignCombo[i]->addItem(tr("Right")); |
|---|
| 242 | myColAlignCombo[i]->addItem(tr("Center")); |
|---|
| 243 | myColumnsLayout->addWidget(myColAlignCombo[i], i+1, 4); |
|---|
| 244 | } |
|---|
| 245 | |
|---|
| 246 | myPageColumnsLayout->addWidget(myColumnsBox); |
|---|
| 247 | myPageColumnsLayout->addStretch(1); |
|---|
| 248 | |
|---|
| 249 | return w; |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | QWidget* Settings::ContactList::createPageContactInfo(QWidget* parent) |
|---|
| 253 | { |
|---|
| 254 | QWidget* w = new QWidget(parent); |
|---|
| 255 | myPageContactInfoLayout = new QVBoxLayout(w); |
|---|
| 256 | myPageContactInfoLayout->setContentsMargins(0, 0, 0, 0); |
|---|
| 257 | |
|---|
| 258 | myPopupBox = new QGroupBox(tr("Popup info")); |
|---|
| 259 | myPopupLayout = new QGridLayout(myPopupBox); |
|---|
| 260 | |
|---|
| 261 | myPopupPictureCheck = new QCheckBox(tr("Picture")); |
|---|
| 262 | myPopupLayout->addWidget(myPopupPictureCheck, 0, 0); |
|---|
| 263 | myPopupAliasCheck = new QCheckBox(tr("Alias")); |
|---|
| 264 | myPopupLayout->addWidget(myPopupAliasCheck, 1, 0); |
|---|
| 265 | myPopupNameCheck = new QCheckBox(tr("Full name")); |
|---|
| 266 | myPopupLayout->addWidget(myPopupNameCheck, 2, 0); |
|---|
| 267 | myPopupEmailCheck = new QCheckBox(tr("Email")); |
|---|
| 268 | myPopupLayout->addWidget(myPopupEmailCheck, 3, 0); |
|---|
| 269 | myPopupPhoneCheck = new QCheckBox(tr("Phone")); |
|---|
| 270 | myPopupLayout->addWidget(myPopupPhoneCheck, 4, 0); |
|---|
| 271 | myPopupFaxCheck = new QCheckBox(tr("Fax")); |
|---|
| 272 | myPopupLayout->addWidget(myPopupFaxCheck, 5, 0); |
|---|
| 273 | myPopupCellularCheck = new QCheckBox(tr("Cellular")); |
|---|
| 274 | myPopupLayout->addWidget(myPopupCellularCheck, 6, 0); |
|---|
| 275 | myPopupIpCheck = new QCheckBox(tr("IP address")); |
|---|
| 276 | myPopupLayout->addWidget(myPopupIpCheck, 0, 1); |
|---|
| 277 | myPopupLastOnlineCheck = new QCheckBox(tr("Last online")); |
|---|
| 278 | myPopupLayout->addWidget(myPopupLastOnlineCheck, 1, 1); |
|---|
| 279 | myPopupOnlineSinceCheck = new QCheckBox(tr("Online time")); |
|---|
| 280 | myPopupLayout->addWidget(myPopupOnlineSinceCheck, 2, 1); |
|---|
| 281 | myPopupIdleTimeCheck = new QCheckBox(tr("Idle time")); |
|---|
| 282 | myPopupLayout->addWidget(myPopupIdleTimeCheck, 3, 1); |
|---|
| 283 | myPopupLocalTimeCheck = new QCheckBox(tr("Local time")); |
|---|
| 284 | myPopupLayout->addWidget(myPopupLocalTimeCheck, 4, 1); |
|---|
| 285 | myPopupIdCheck = new QCheckBox(tr("Protocol ID")); |
|---|
| 286 | myPopupLayout->addWidget(myPopupIdCheck, 5, 1); |
|---|
| 287 | myPopupAuthCheck = new QCheckBox(tr("Authorization status")); |
|---|
| 288 | myPopupLayout->addWidget(myPopupAuthCheck, 6, 1); |
|---|
| 289 | |
|---|
| 290 | myAutoUpdateBox = new QGroupBox(tr("Automatic Update")); |
|---|
| 291 | myAutoUpdateLayout = new QVBoxLayout(myAutoUpdateBox); |
|---|
| 292 | |
|---|
| 293 | myAutoUpdateInfoCheck = new QCheckBox(tr("Contact information")); |
|---|
| 294 | myAutoUpdateInfoCheck->setToolTip(tr("Automatically update users' server stored information.")); |
|---|
| 295 | myAutoUpdateLayout->addWidget(myAutoUpdateInfoCheck); |
|---|
| 296 | |
|---|
| 297 | myAutoUpdateInfoPluginsCheck = new QCheckBox(tr("Info plugins")); |
|---|
| 298 | myAutoUpdateInfoPluginsCheck->setToolTip(tr("Automatically update users' Phone Book and Picture.")); |
|---|
| 299 | myAutoUpdateLayout->addWidget(myAutoUpdateInfoPluginsCheck); |
|---|
| 300 | |
|---|
| 301 | myAutoUpdateStatusPluginsCheck = new QCheckBox(tr("Status plugins")); |
|---|
| 302 | myAutoUpdateStatusPluginsCheck->setToolTip(tr("Automatically update users' Phone \"Follow Me\", File Server and ICQphone status.")); |
|---|
| 303 | myAutoUpdateLayout->addWidget(myAutoUpdateStatusPluginsCheck); |
|---|
| 304 | |
|---|
| 305 | myPageContactInfoLayout->addWidget(myPopupBox); |
|---|
| 306 | myPageContactInfoLayout->addWidget(myAutoUpdateBox); |
|---|
| 307 | myPageContactInfoLayout->addStretch(1); |
|---|
| 308 | |
|---|
| 309 | return w; |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | void Settings::ContactList::numColumnsChanged() |
|---|
| 313 | { |
|---|
| 314 | // Starting from the top, rows should be enabled |
|---|
| 315 | bool enableRow = true; |
|---|
| 316 | |
|---|
| 317 | for (unsigned short i = 0; i < MAX_COLUMNCOUNT; ++i) |
|---|
| 318 | { |
|---|
| 319 | myColTitleEdit[i]->setEnabled(enableRow); |
|---|
| 320 | myColFormatEdit[i]->setEnabled(enableRow); |
|---|
| 321 | myColWidthSpin[i]->setEnabled(enableRow); |
|---|
| 322 | myColAlignCombo[i]->setEnabled(enableRow); |
|---|
| 323 | |
|---|
| 324 | // We've found the checked row, so all rows below this should be disabled |
|---|
| 325 | if(myColNumberRadio[i]->isChecked()) |
|---|
| 326 | enableRow = false; |
|---|
| 327 | } |
|---|
| 328 | } |
|---|
| 329 | |
|---|
| 330 | void Settings::ContactList::load() |
|---|
| 331 | { |
|---|
| 332 | Config::Chat* chatConfig = Config::Chat::instance(); |
|---|
| 333 | Config::ContactList* contactListConfig = Config::ContactList::instance(); |
|---|
| 334 | Config::General* generalConfig = Config::General::instance(); |
|---|
| 335 | |
|---|
| 336 | myManualNewUserCheck->setChecked(chatConfig->manualNewUser()); |
|---|
| 337 | |
|---|
| 338 | myShowGroupIfNoMsgCheck->setChecked(generalConfig->showGroupIfNoMsg()); |
|---|
| 339 | myEnableMainwinMouseMovementCheck->setChecked(generalConfig->mainwinDraggable()); |
|---|
| 340 | myMainWinStickyCheck->setChecked(generalConfig->mainwinSticky()); |
|---|
| 341 | |
|---|
| 342 | myGridLinesCheck->setChecked(contactListConfig->showGridLines()); |
|---|
| 343 | myFontStylesCheck->setChecked(contactListConfig->useFontStyles()); |
|---|
| 344 | myShowExtIconsCheck->setChecked(contactListConfig->showExtendedIcons()); |
|---|
| 345 | myShowPhoneIconsCheck->setChecked(contactListConfig->showPhoneIcons()); |
|---|
| 346 | myShowPhoneIconsCheck->setEnabled(contactListConfig->showExtendedIcons()); |
|---|
| 347 | myHeaderCheck->setChecked(contactListConfig->showHeader()); |
|---|
| 348 | myShowDividersCheck->setChecked(contactListConfig->showDividers()); |
|---|
| 349 | mySortByCombo->setCurrentIndex(contactListConfig->sortByStatus()); |
|---|
| 350 | myAlwaysShowONUCheck->setChecked(contactListConfig->alwaysShowONU()); |
|---|
| 351 | myShowUserIconsCheck->setChecked(contactListConfig->showUserIcons()); |
|---|
| 352 | myScrollBarCheck->setChecked(contactListConfig->allowScrollBar()); |
|---|
| 353 | mySysBackCheck->setChecked(contactListConfig->useSystemBackground()); |
|---|
| 354 | myDragMovesUserCheck->setChecked(contactListConfig->dragMovesUser()); |
|---|
| 355 | |
|---|
| 356 | int numColumns = contactListConfig->columnCount(); |
|---|
| 357 | if(numColumns < 1) |
|---|
| 358 | myColNumberRadio[0]->setChecked(true); |
|---|
| 359 | else if(numColumns > MAX_COLUMNCOUNT) |
|---|
| 360 | myColNumberRadio[MAX_COLUMNCOUNT - 1]->setChecked(true); |
|---|
| 361 | else |
|---|
| 362 | myColNumberRadio[numColumns - 1]->setChecked(true); |
|---|
| 363 | |
|---|
| 364 | for (int i = 0; i < MAX_COLUMNCOUNT; ++i) |
|---|
| 365 | { |
|---|
| 366 | myColTitleEdit[i]->setText(contactListConfig->columnHeading(i)); |
|---|
| 367 | myColFormatEdit[i]->setText(contactListConfig->columnFormat(i)); |
|---|
| 368 | myColWidthSpin[i]->setValue(contactListConfig->columnWidth(i)); |
|---|
| 369 | myColAlignCombo[i]->setCurrentIndex(contactListConfig->columnAlignment(i)); |
|---|
| 370 | |
|---|
| 371 | myColTitleEdit[i]->setEnabled(i < numColumns); |
|---|
| 372 | myColFormatEdit[i]->setEnabled(i < numColumns); |
|---|
| 373 | myColWidthSpin[i]->setEnabled(i < numColumns); |
|---|
| 374 | myColAlignCombo[i]->setEnabled(i < numColumns); |
|---|
| 375 | } |
|---|
| 376 | |
|---|
| 377 | myPopupPictureCheck->setChecked(contactListConfig->popupPicture()); |
|---|
| 378 | myPopupAliasCheck->setChecked(contactListConfig->popupAlias()); |
|---|
| 379 | myPopupAuthCheck->setChecked(contactListConfig->popupAuth()); |
|---|
| 380 | myPopupNameCheck->setChecked(contactListConfig->popupName()); |
|---|
| 381 | myPopupEmailCheck->setChecked(contactListConfig->popupEmail()); |
|---|
| 382 | myPopupPhoneCheck->setChecked(contactListConfig->popupPhone()); |
|---|
| 383 | myPopupFaxCheck->setChecked(contactListConfig->popupFax()); |
|---|
| 384 | myPopupCellularCheck->setChecked(contactListConfig->popupCellular()); |
|---|
| 385 | myPopupIpCheck->setChecked(contactListConfig->popupIP()); |
|---|
| 386 | myPopupLastOnlineCheck->setChecked(contactListConfig->popupLastOnline()); |
|---|
| 387 | myPopupOnlineSinceCheck->setChecked(contactListConfig->popupOnlineSince()); |
|---|
| 388 | myPopupIdleTimeCheck->setChecked(contactListConfig->popupIdleTime()); |
|---|
| 389 | myPopupLocalTimeCheck->setChecked(contactListConfig->popupLocalTime()); |
|---|
| 390 | myPopupIdCheck->setChecked(contactListConfig->popupID()); |
|---|
| 391 | |
|---|
| 392 | mySSListCheck->setChecked(gLicqDaemon->UseServerContactList()); |
|---|
| 393 | myTransparentCheck->setChecked(Config::Skin::active()->frame.transparent); |
|---|
| 394 | myFrameStyleEdit->setText(QString::number(static_cast<int>(Config::Skin::active()->frame.frameStyle))); |
|---|
| 395 | |
|---|
| 396 | myAutoUpdateInfoCheck->setChecked(gLicqDaemon->AutoUpdateInfo()); |
|---|
| 397 | myAutoUpdateInfoPluginsCheck->setChecked(gLicqDaemon->AutoUpdateInfoPlugins()); |
|---|
| 398 | myAutoUpdateStatusPluginsCheck->setChecked(gLicqDaemon->AutoUpdateStatusPlugins()); |
|---|
| 399 | } |
|---|
| 400 | |
|---|
| 401 | void Settings::ContactList::apply() |
|---|
| 402 | { |
|---|
| 403 | Config::Chat* chatConfig = Config::Chat::instance(); |
|---|
| 404 | Config::ContactList* contactListConfig = Config::ContactList::instance(); |
|---|
| 405 | Config::General* generalConfig = Config::General::instance(); |
|---|
| 406 | chatConfig->blockUpdates(true); |
|---|
| 407 | contactListConfig->blockUpdates(true); |
|---|
| 408 | generalConfig->blockUpdates(true); |
|---|
| 409 | |
|---|
| 410 | chatConfig->setManualNewUser(myManualNewUserCheck->isChecked()); |
|---|
| 411 | |
|---|
| 412 | generalConfig->setShowGroupIfNoMsg(myShowGroupIfNoMsgCheck->isChecked()); |
|---|
| 413 | generalConfig->setMainwinDraggable(myEnableMainwinMouseMovementCheck->isChecked()); |
|---|
| 414 | generalConfig->setMainwinSticky(myMainWinStickyCheck->isChecked()); |
|---|
| 415 | |
|---|
| 416 | contactListConfig->setShowGridLines(myGridLinesCheck->isChecked()); |
|---|
| 417 | contactListConfig->setUseFontStyles(myFontStylesCheck->isChecked()); |
|---|
| 418 | contactListConfig->setShowExtendedIcons(myShowExtIconsCheck->isChecked()); |
|---|
| 419 | contactListConfig->setShowPhoneIcons(myShowPhoneIconsCheck->isChecked()); |
|---|
| 420 | contactListConfig->setShowHeader(myHeaderCheck->isChecked()); |
|---|
| 421 | contactListConfig->setShowDividers(myShowDividersCheck->isChecked()); |
|---|
| 422 | contactListConfig->setSortByStatus(mySortByCombo->currentIndex()); |
|---|
| 423 | contactListConfig->setAlwaysShowONU(myAlwaysShowONUCheck->isChecked()); |
|---|
| 424 | contactListConfig->setShowUserIcons(myShowUserIconsCheck->isChecked()); |
|---|
| 425 | contactListConfig->setAllowScrollBar(myScrollBarCheck->isChecked()); |
|---|
| 426 | contactListConfig->setUseSystemBackground(mySysBackCheck->isChecked()); |
|---|
| 427 | contactListConfig->setDragMovesUser(myDragMovesUserCheck->isChecked()); |
|---|
| 428 | |
|---|
| 429 | for (unsigned short i = 0; i < MAX_COLUMNCOUNT; ++i) |
|---|
| 430 | { |
|---|
| 431 | contactListConfig->setColumn(i, |
|---|
| 432 | myColTitleEdit[i]->text(), |
|---|
| 433 | myColFormatEdit[i]->text(), |
|---|
| 434 | myColWidthSpin[i]->value(), |
|---|
| 435 | static_cast<Config::ContactList::AlignmentMode>(myColAlignCombo[i]->currentIndex())); |
|---|
| 436 | |
|---|
| 437 | if (myColNumberRadio[i]->isChecked()) |
|---|
| 438 | contactListConfig->setColumnCount(i + 1); |
|---|
| 439 | } |
|---|
| 440 | |
|---|
| 441 | contactListConfig->setPopupPicture(myPopupPictureCheck->isChecked()); |
|---|
| 442 | contactListConfig->setPopupAlias(myPopupAliasCheck->isChecked()); |
|---|
| 443 | contactListConfig->setPopupAuth(myPopupAuthCheck->isChecked()); |
|---|
| 444 | contactListConfig->setPopupName(myPopupNameCheck->isChecked()); |
|---|
| 445 | contactListConfig->setPopupEmail(myPopupEmailCheck->isChecked()); |
|---|
| 446 | contactListConfig->setPopupPhone(myPopupPhoneCheck->isChecked()); |
|---|
| 447 | contactListConfig->setPopupFax(myPopupFaxCheck->isChecked()); |
|---|
| 448 | contactListConfig->setPopupCellular(myPopupCellularCheck->isChecked()); |
|---|
| 449 | contactListConfig->setPopupIP(myPopupIpCheck->isChecked()); |
|---|
| 450 | contactListConfig->setPopupLastOnline(myPopupLastOnlineCheck->isChecked()); |
|---|
| 451 | contactListConfig->setPopupOnlineSince(myPopupOnlineSinceCheck->isChecked()); |
|---|
| 452 | contactListConfig->setPopupIdleTime(myPopupIdleTimeCheck->isChecked()); |
|---|
| 453 | contactListConfig->setPopupLocalTime(myPopupLocalTimeCheck->isChecked()); |
|---|
| 454 | contactListConfig->setPopupID(myPopupIdCheck->isChecked()); |
|---|
| 455 | |
|---|
| 456 | gLicqDaemon->SetUseServerContactList(mySSListCheck->isChecked()); |
|---|
| 457 | Config::Skin::active()->setFrameTransparent(myTransparentCheck->isChecked()); |
|---|
| 458 | Config::Skin::active()->setFrameStyle(myFrameStyleEdit->text().toUShort()); |
|---|
| 459 | |
|---|
| 460 | gLicqDaemon->SetAutoUpdateInfo(myAutoUpdateInfoCheck->isChecked()); |
|---|
| 461 | gLicqDaemon->SetAutoUpdateInfoPlugins(myAutoUpdateInfoPluginsCheck->isChecked()); |
|---|
| 462 | gLicqDaemon->SetAutoUpdateStatusPlugins(myAutoUpdateStatusPluginsCheck->isChecked()); |
|---|
| 463 | |
|---|
| 464 | chatConfig->blockUpdates(false); |
|---|
| 465 | contactListConfig->blockUpdates(false); |
|---|
| 466 | generalConfig->blockUpdates(false); |
|---|
| 467 | } |
|---|