Changeset 4702
- Timestamp:
- 10/15/06 23:32:51 (2 years ago)
- Location:
- trunk/qt-gui/src
- Files:
-
- 6 modified
-
ewidgets.cpp (modified) (9 diffs)
-
ewidgets.h (modified) (1 diff)
-
mainwin.cpp (modified) (2 diffs)
-
mainwin.h (modified) (1 diff)
-
optionsdlg.cpp (modified) (8 diffs)
-
optionsdlg.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt-gui/src/ewidgets.cpp
r4699 r4702 669 669 m_nPPID = nPPID; 670 670 m_nMsgStyle = m->m_nMsgStyle; 671 m_nDateFormat = m->m_nDateFormat; 671 672 m_bAppendLineBreak = m->m_bAppendLineBreak; 672 673 m_colorRcv = m->m_colorRcv; … … 702 703 m_szId = NULL; // avoid desalocation error at destructor 703 704 m_nMsgStyle = m->m_nMsgStyle; 705 m_nDateFormat = m->m_nDateFormat; 704 706 m_bAppendLineBreak = m->m_bAppendLineBreak; 705 707 m_colorRcv = m->m_colorRcv; … … 777 779 } 778 780 781 QString my_date = date.toString( m_nDateFormat ); 779 782 780 783 switch (m_nMsgStyle) { … … 783 786 .arg(color) 784 787 .arg(eventDescription) 785 .arg( date.time().toString())788 .arg(my_date) 786 789 .arg(isDirect ? 'D' : '-') 787 790 .arg(isMultiRec ? 'M' : '-') … … 797 800 .arg(color) 798 801 .arg(eventDescription) 799 .arg( date.time().toString())802 .arg(my_date) 800 803 .arg(isDirect ? 'D' : '-') 801 804 .arg(isMultiRec ? 'M' : '-') … … 817 820 .arg(color) 818 821 .arg(eventDescription) 819 .arg( date.time().toString())822 .arg(my_date) 820 823 .arg(contactName); 821 824 s.append(QString("<font color=\"%1\">%2</font>") … … 834 837 .arg(color) 835 838 .arg(eventDescription) 836 .arg( date.time().toString())839 .arg(my_date) 837 840 .arg(color) 838 841 .arg(contactName); … … 847 850 .arg(eventDescription) 848 851 .arg(contactName) 849 .arg( date.toString())852 .arg(my_date) 850 853 .arg(isDirect ? 'D' : '-') 851 854 .arg(isMultiRec ? 'M' : '-') … … 872 875 QDateTime date; 873 876 date.setTime_t(e->Time()); 874 QString sd = date.time().toString( );877 QString sd = date.time().toString( m_nDateFormat ); 875 878 bool bUseHTML = false; 876 879 -
trunk/qt-gui/src/ewidgets.h
r4699 r4702 212 212 213 213 unsigned short m_nMsgStyle; 214 QString m_nDateFormat; 214 215 bool m_bAppendLineBreak; 215 216 QColor m_colorRcvHistory; -
trunk/qt-gui/src/mainwin.cpp
r4699 r4702 441 441 licqConf.ReadBool("SingleLineChatMode", m_bSingleLineChatMode, false); 442 442 licqConf.ReadBool("CheckSpellingEnabled", m_bCheckSpellingEnabled, false); 443 licqConf.ReadStr("DateFormat", szTemp, "hh:mm:ss"); 444 m_nDateFormat = QString::fromLatin1(szTemp); 443 445 444 446 licqConf.ReadStr("ReceiveMessageColor", szTemp, "red"); … … 3581 3583 licqConf.WriteStr("TabOnTypingColor", m_colorTabTyping.name()); 3582 3584 licqConf.WriteStr("ChatBackground", m_colorChatBkg.name()); 3583 3585 licqConf.WriteStr("DateFormat", m_nDateFormat.latin1()); 3586 3584 3587 licqConf.WriteBool("showPopAlias", m_bPopAlias); 3585 3588 licqConf.WriteBool("showPopName", m_bPopName); -
trunk/qt-gui/src/mainwin.h
r4699 r4702 180 180 m_nSortColumn, 181 181 m_nMsgStyle; 182 QString m_nDateFormat; 182 183 183 184 QColor m_colorRcvHistory, -
trunk/qt-gui/src/optionsdlg.cpp
r4699 r4702 212 212 chkSendFromClipboard->setChecked(mainwin->m_bSendFromClipboard); 213 213 chkMsgChatView->setChecked(mainwin->m_bMsgChatView); 214 214 215 bool isCustomDate = true; 216 for (int i = 0; i < cmbDateFormat->count(); i++) 217 { 218 if (cmbDateFormat->text(i) == mainwin->m_nDateFormat) 219 { 220 cmbDateFormat->setCurrentItem(i); 221 isCustomDate = false; 222 break; 223 } 224 } 225 226 // Make sure the checkbox is actually toggled, so that widgets are enabled/disabled. 227 chkCustomDateFormat->setChecked(!isCustomDate); 228 chkCustomDateFormat->setChecked(isCustomDate); 229 230 customDateFormat->setText(mainwin->m_nDateFormat); 231 215 232 chkLineBreak->setChecked(mainwin->m_bAppendLineBreak); 216 233 cmbStyle->setCurrentItem(mainwin->m_nMsgStyle); … … 510 527 mainwin->m_bAppendLineBreak = chkLineBreak->isChecked(); 511 528 mainwin->m_nMsgStyle = cmbStyle->currentItem(); 529 mainwin->m_nDateFormat = getCurrentDateFormat(); 512 530 mainwin->m_colorRcv = btnColorRcv->paletteBackgroundColor(); 513 531 mainwin->m_colorSnt = btnColorSnt->paletteBackgroundColor(); … … 1542 1560 QVBox* boxRight = new QVBox(w); 1543 1561 lay->addWidget(boxRight); 1544 1562 1545 1563 QGroupBox* boxOptions = new QGroupBox(1, Horizontal, tr("Options"), boxRight); 1546 1564 … … 1553 1571 cmbStyle->insertItem("History"); 1554 1572 connect(cmbStyle, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 1555 1573 1556 1574 chkLineBreak = new QCheckBox(tr("Insert Horizontal Line"), boxOptions); 1557 1575 connect(chkLineBreak, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 1558 1576 1577 new QLabel(tr("Date Format:"), boxOptions); 1578 cmbDateFormat = new QComboBox(false, boxOptions); 1579 cmbDateFormat->insertItem("hh:mm:ss"); 1580 cmbDateFormat->insertItem("yyyy-MM-dd hh:mm:ss"); 1581 cmbDateFormat->insertItem("yyyy-MM-dd"); 1582 cmbDateFormat->insertItem("yyyy/MM/dd hh:mm:ss"); 1583 cmbDateFormat->insertItem("yyyy/MM/dd"); 1584 connect(cmbDateFormat, SIGNAL(activated(int)), this, SLOT(slot_refresh_msgViewer())); 1585 1586 chkCustomDateFormat = new QCheckBox(tr("Custom Date Format"), boxOptions); 1587 connect(chkCustomDateFormat, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 1588 connect(chkCustomDateFormat, SIGNAL(toggled(bool)), cmbDateFormat, SLOT(setDisabled(bool))); 1589 1590 customDateFormat = new QLineEdit(boxOptions); 1591 connect(chkCustomDateFormat, SIGNAL(toggled(bool)), customDateFormat, SLOT(setEnabled(bool))); 1592 connect(customDateFormat, SIGNAL(textChanged(const QString&)), this, SLOT(slot_refresh_msgViewer())); 1593 QWhatsThis::add(customDateFormat, tr( 1594 "<p>Available custom date format variables.</p>" 1595 "<table>" 1596 "<tr><th>Expression</th><th>Output</th></tr>" 1597 "<tr><td>d</td> <td>the day as number without a leading zero (1-31)</td></tr>" 1598 "<tr><td>dd</td> <td>the day as number with a leading zero (01-31)</td></tr>" 1599 "<tr><td>ddd</td> <td>the abbreviated localized day name (e.g. 'Mon'..'Sun')</td></tr>" 1600 "<tr><td>dddd</td><td>the long localized day name (e.g. 'Monday'..'Sunday')</td></tr>" 1601 "<tr><td>M</td> <td>the month as number without a leading zero (1-12)</td></tr>" 1602 "<tr><td>MM</td> <td>the month as number with a leading zero (01-12)</td></tr>" 1603 "<tr><td>MMM</td> <td>the abbreviated localized month name (e.g. 'Jan'..'Dec')</td></tr>" 1604 "<tr><td>MMMM</td><td>the long localized month name (e.g. 'January'..'December')</td></tr>" 1605 "<tr><td>yy</td> <td>the year as two digit number (00-99)</td></tr>" 1606 "<tr><td>yyyy</td><td>the year as four digit number (1752-8000)</td></tr>" 1607 "<tr><td colspan=2></td></tr>" 1608 "<tr><td>h</td> <td>the hour without a leading zero (0..23 or 1..12 if AM/PM display)</td></tr>" 1609 "<tr><td>hh</td> <td>the hour with a leading zero (00..23 or 01..12 if AM/PM display</td></tr>" 1610 "<tr><td>m</td> <td>the minute without a leading zero (0..59</td></tr>" 1611 "<tr><td>mm</td> <td>the minute with a leading zero (00..59</td></tr>" 1612 "<tr><td>s</td> <td>the second whithout a leading zero (0..59)</td></tr>" 1613 "<tr><td>ss</td> <td>the second whith a leading zero (00..59</td></tr>" 1614 "<tr><td>z</td> <td>the milliseconds without leading zeroes (0..999)</td></tr>" 1615 "<tr><td>zzz</td> <td>the milliseconds with leading zeroes (000..999</td></tr>" 1616 "<tr><td>AP</td> <td>use AM/PM display. AP will be replaced by either 'AM' or 'PM'</td></tr>" 1617 "<tr><td>ap</td> <td>use am/pm display. ap will be replaced by either 'am' or 'pm'</td></tr>" 1618 "</table>")); 1619 1559 1620 QGroupBox *boxColors = new QGroupBox(2, Horizontal, tr("Colors"), boxRight); 1560 1621 1561 1622 new QLabel(tr("Message Received:"), boxColors); 1562 1623 btnColorRcv = new CColorOption(boxColors); 1563 1624 1564 1625 new QLabel(tr("Message Sent:"), boxColors); 1565 1626 btnColorSnt = new CColorOption(boxColors); … … 1587 1648 connect(btnColorTypingLabel, SIGNAL(changed()), this, SLOT(slot_refresh_msgViewer())); 1588 1649 connect(btnColorChatBkg, SIGNAL(changed()), this, SLOT(slot_refresh_msgViewer())); 1589 1650 1590 1651 tabViewer = new QTabWidget(w); 1591 1652 lay->addWidget(tabViewer); 1592 1653 1593 1654 msgViewer = new CMessageViewWidget(0, gMainWindow, tabViewer); 1594 1655 tabViewer->insertTab(msgViewer, "Marge"); 1595 1656 1596 1657 lay->activate(); 1597 1658 … … 1599 1660 } 1600 1661 1662 QString OptionsDlg::getCurrentDateFormat() const 1663 { 1664 if (chkCustomDateFormat->isChecked()) 1665 return customDateFormat->text(); 1666 else 1667 return cmbDateFormat->currentText(); 1668 } 1669 1601 1670 void OptionsDlg::slot_refresh_msgViewer() 1602 1671 { 1603 QDateTime date; 1672 // Don't update the time at every refresh 1673 static QDateTime date = QDateTime::currentDateTime(); 1674 1604 1675 const char *names[2] = {"Marge", "Homer"}; 1605 1676 const char *msgs[7] = { … … 1611 1682 "Cool, I'll see you there :)", 1612 1683 "We'll be waiting!"}; 1613 1684 1614 1685 msgViewer->m_nMsgStyle = cmbStyle->currentItem(); 1615 1686 msgViewer->m_bAppendLineBreak = chkLineBreak->isChecked(); … … 1620 1691 tabViewer->setPaletteForegroundColor(btnColorTypingLabel->paletteBackgroundColor()); 1621 1692 msgViewer->setPaletteBackgroundColor(btnColorChatBkg->paletteBackgroundColor()); 1622 1693 1694 msgViewer->m_nDateFormat = getCurrentDateFormat(); 1695 1623 1696 msgViewer->clear(); 1624 1697 for (unsigned int i = 0; i<7; i++) -
trunk/qt-gui/src/optionsdlg.h
r4699 r4702 163 163 QTabWidget *tabViewer; 164 164 QComboBox *cmbStyle; 165 QComboBox *cmbDateFormat; 166 QCheckBox *chkCustomDateFormat; 167 QLineEdit *customDateFormat; 165 168 QCheckBox *chkLineBreak; 166 169 CColorOption *btnColorRcv; … … 201 204 void slot_chkOnEventsToggled(bool); 202 205 void slot_refresh_msgViewer(); 206 207 private: 208 QString getCurrentDateFormat() const; 203 209 }; 204 210
