| 215 | | |
| 216 | | bool isCustomDate = true; |
| 217 | | for (int i = 0; i < cmbDateFormat->count(); i++) |
| 218 | | { |
| 219 | | if (cmbDateFormat->text(i) == mainwin->m_nDateFormat) |
| 220 | | { |
| 221 | | cmbDateFormat->setCurrentItem(i); |
| 222 | | isCustomDate = false; |
| 223 | | break; |
| 224 | | } |
| 225 | | } |
| 226 | | |
| 227 | | // Make sure the checkbox is actually toggled, so that widgets are enabled/disabled. |
| 228 | | chkCustomDateFormat->setChecked(!isCustomDate); |
| 229 | | chkCustomDateFormat->setChecked(isCustomDate); |
| 230 | | |
| 231 | | customDateFormat->setText(mainwin->m_nDateFormat); |
| 232 | | |
| 233 | | chkLineBreak->setChecked(mainwin->m_bAppendLineBreak); |
| 234 | | cmbStyle->setCurrentItem(mainwin->m_nMsgStyle); |
| | 215 | cmbChatDateFormat->lineEdit()->setText(mainwin->m_chatDateFormat); |
| | 216 | chkChatVertSpacing->setChecked(mainwin->m_chatVertSpacing); |
| | 217 | chkChatLineBreak->setChecked(mainwin->m_chatAppendLineBreak); |
| | 218 | cmbChatStyle->setCurrentItem(mainwin->m_chatMsgStyle); |
| | 219 | cmbHistStyle->setCurrentItem(mainwin->m_histMsgStyle); |
| | 220 | chkHistVertSpacing->setChecked(mainwin->m_histVertSpacing); |
| | 221 | cmbHistDateFormat->lineEdit()->setText(mainwin->m_histDateFormat); |
| 1569 | | QGroupBox* boxOptions = new QGroupBox(1, Horizontal, tr("Options"), boxRight); |
| 1570 | | |
| 1571 | | new QLabel(tr("Style:"), boxOptions); |
| 1572 | | cmbStyle = new QComboBox(false, boxOptions); |
| 1573 | | cmbStyle->insertItem("Default"); |
| 1574 | | cmbStyle->insertItem("Compact"); |
| 1575 | | cmbStyle->insertItem("Tiny"); |
| 1576 | | cmbStyle->insertItem("Table"); |
| 1577 | | cmbStyle->insertItem("History"); |
| 1578 | | connect(cmbStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); |
| 1579 | | |
| 1580 | | chkLineBreak = new QCheckBox(tr("Insert Horizontal Line"), boxOptions); |
| 1581 | | connect(chkLineBreak, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); |
| 1582 | | |
| 1583 | | new QLabel(tr("Date Format:"), boxOptions); |
| 1584 | | cmbDateFormat = new QComboBox(false, boxOptions); |
| 1585 | | cmbDateFormat->insertItem("hh:mm:ss"); |
| 1586 | | cmbDateFormat->insertItem("yyyy-MM-dd hh:mm:ss"); |
| 1587 | | cmbDateFormat->insertItem("yyyy-MM-dd"); |
| 1588 | | cmbDateFormat->insertItem("yyyy/MM/dd hh:mm:ss"); |
| 1589 | | cmbDateFormat->insertItem("yyyy/MM/dd"); |
| 1590 | | cmbDateFormat->insertItem("dd.MM.yyyy hh:mm:ss"); |
| 1591 | | cmbDateFormat->insertItem("dd.MM.yyyy"); |
| 1592 | | connect(cmbDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); |
| 1593 | | |
| 1594 | | chkCustomDateFormat = new QCheckBox(tr("Custom Date Format:"), boxOptions); |
| 1595 | | connect(chkCustomDateFormat, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); |
| 1596 | | connect(chkCustomDateFormat, SIGNAL(toggled(bool)), cmbDateFormat, SLOT(setDisabled(bool))); |
| 1597 | | |
| 1598 | | customDateFormat = new QLineEdit(boxOptions); |
| 1599 | | connect(chkCustomDateFormat, SIGNAL(toggled(bool)), customDateFormat, SLOT(setEnabled(bool))); |
| 1600 | | connect(customDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); |
| 1601 | | QWhatsThis::add(customDateFormat, tr( |
| | 1560 | QGroupBox* boxChatOptions = new QGroupBox(1, Horizontal, tr("Chat Options"), boxRight); |
| | 1561 | |
| | 1562 | static const int dateFormatsLength = 7; |
| | 1563 | static const char *const dateFormats[dateFormatsLength] = { |
| | 1564 | "hh:mm:ss", |
| | 1565 | "yyyy-MM-dd hh:mm:ss", |
| | 1566 | "yyyy-MM-dd", |
| | 1567 | "yyyy/MM/dd hh:mm:ss", |
| | 1568 | "yyyy/MM/dd", |
| | 1569 | "dd.MM.yyyy hh:mm:ss", |
| | 1570 | "dd.MM.yyyy" |
| | 1571 | }; |
| | 1572 | |
| | 1573 | new QLabel(tr("Style:"), boxChatOptions); |
| | 1574 | cmbChatStyle = new QComboBox(false, boxChatOptions); |
| | 1575 | cmbChatStyle->insertStringList(CMessageViewWidget::getStyleNames(false)); |
| | 1576 | connect(cmbChatStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); |
| | 1577 | |
| | 1578 | chkChatVertSpacing = new QCheckBox(tr("Insert Vertical Spacing"), boxChatOptions); |
| | 1579 | connect(chkChatVertSpacing, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); |
| | 1580 | QWhatsThis::add(chkChatVertSpacing, tr("Insert extra space between messages.")); |
| | 1581 | |
| | 1582 | chkChatLineBreak = new QCheckBox(tr("Insert Horizontal Line"), boxChatOptions); |
| | 1583 | connect(chkChatLineBreak, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); |
| | 1584 | QWhatsThis::add(chkChatLineBreak, tr("Insert a line between each message.")); |
| | 1585 | |
| | 1586 | QLabel* lblChatDateFormat = new QLabel(tr("Date Format:"), boxChatOptions); |
| | 1587 | cmbChatDateFormat = new QComboBox(true, boxChatOptions); |
| | 1588 | for(int i = 0; i < dateFormatsLength; ++i) |
| | 1589 | cmbChatDateFormat->insertItem(dateFormats[i]); |
| | 1590 | connect(cmbChatDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); |
| | 1591 | connect(cmbChatDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); |
| | 1592 | |
| | 1593 | QString helpDateFormat = tr( |
| 1626 | | "</table>")); |
| | 1618 | "</table>"); |
| | 1619 | |
| | 1620 | QWhatsThis::add(lblChatDateFormat, helpDateFormat); |
| | 1621 | QWhatsThis::add(cmbChatDateFormat, helpDateFormat); |
| | 1622 | |
| | 1623 | QGroupBox* boxHistOptions = new QGroupBox(1, Horizontal, tr("History Options"), boxRight); |
| | 1624 | new QLabel(tr("Style:"), boxHistOptions); |
| | 1625 | cmbHistStyle = new QComboBox(false, boxHistOptions); |
| | 1626 | cmbHistStyle->insertStringList(CMessageViewWidget::getStyleNames(true)); |
| | 1627 | connect(cmbHistStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); |
| | 1628 | |
| | 1629 | chkHistVertSpacing = new QCheckBox(tr("Insert Vertical Spacing"), boxHistOptions); |
| | 1630 | connect(chkHistVertSpacing, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); |
| | 1631 | QWhatsThis::add(chkHistVertSpacing, tr("Insert extra space between messages.")); |
| | 1632 | |
| | 1633 | QLabel* lblHistDateFormat = new QLabel(tr("Date Format:"), boxHistOptions); |
| | 1634 | cmbHistDateFormat = new QComboBox(true, boxHistOptions); |
| | 1635 | for(int i = 0; i < dateFormatsLength; ++i) |
| | 1636 | cmbHistDateFormat->insertItem(dateFormats[i]); |
| | 1637 | connect(cmbHistDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); |
| | 1638 | connect(cmbHistDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); |
| | 1639 | QWhatsThis::add(lblHistDateFormat, helpDateFormat); |
| | 1640 | QWhatsThis::add(cmbHistDateFormat, helpDateFormat); |
| | 1641 | |
| 1699 | | msgViewer->m_nMsgStyle = cmbStyle->currentItem(); |
| 1700 | | msgViewer->m_bAppendLineBreak = chkLineBreak->isChecked(); |
| 1701 | | msgViewer->m_colorSnt = btnColorSnt->paletteBackgroundColor(); |
| 1702 | | msgViewer->m_colorRcv = btnColorRcv->paletteBackgroundColor(); |
| 1703 | | msgViewer->m_colorSntHistory = btnColorSntHistory->paletteBackgroundColor(); |
| 1704 | | msgViewer->m_colorRcvHistory = btnColorRcvHistory->paletteBackgroundColor(); |
| 1705 | | msgViewer->m_colorNotice = btnColorNotice->paletteBackgroundColor(); |
| 1706 | | tabViewer->setPaletteForegroundColor(btnColorTypingLabel->paletteBackgroundColor()); |
| 1707 | | msgViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); |
| 1708 | | |
| 1709 | | msgViewer->m_nDateFormat = getCurrentDateFormat(); |
| 1710 | | |
| 1711 | | msgViewer->clear(); |
| | 1709 | msgChatViewer->m_nMsgStyle = cmbChatStyle->currentItem(); |
| | 1710 | msgChatViewer->m_extraSpacing = chkChatVertSpacing->isChecked(); |
| | 1711 | msgChatViewer->m_appendLineBreak = chkChatLineBreak->isChecked(); |
| | 1712 | msgChatViewer->m_colorSnt = btnColorSnt->paletteBackgroundColor(); |
| | 1713 | msgChatViewer->m_colorRcv = btnColorRcv->paletteBackgroundColor(); |
| | 1714 | msgChatViewer->m_colorSntHistory = btnColorSntHistory->paletteBackgroundColor(); |
| | 1715 | msgChatViewer->m_colorRcvHistory = btnColorRcvHistory->paletteBackgroundColor(); |
| | 1716 | msgChatViewer->m_colorNotice = btnColorNotice->paletteBackgroundColor(); |
| | 1717 | tabViewer->setTabColor(msgChatViewer, btnColorTypingLabel->paletteBackgroundColor()); |
| | 1718 | msgChatViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); |
| | 1719 | |
| | 1720 | msgChatViewer->m_nDateFormat = cmbChatDateFormat->currentText(); |
| | 1721 | |
| | 1722 | msgHistViewer->m_nMsgStyle = cmbHistStyle->currentItem(); |
| | 1723 | msgHistViewer->m_extraSpacing = chkHistVertSpacing->isChecked(); |
| | 1724 | msgHistViewer->m_colorSnt = btnColorSnt->paletteBackgroundColor(); |
| | 1725 | msgHistViewer->m_colorRcv = btnColorRcv->paletteBackgroundColor(); |
| | 1726 | msgHistViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); |
| | 1727 | msgHistViewer->m_nDateFormat = cmbHistDateFormat->currentText(); |
| | 1728 | |
| | 1729 | msgChatViewer->clear(); |
| | 1730 | msgHistViewer->clear(); |