@ -33,7 +33,10 @@
@@ -33,7 +33,10 @@
static QStringList locales = { " bg " , " de " , " en " , " es " , " fr " , " hr " , " hu " , " it " , " lt " , " mannol " , " nl " , " pirate " , " pl " , " pt " , " ru " , " sl " , " fi " , " sv " , " uk " , " zh " } ;
static QStringList langs = { " Български " , " Deutsch " , " English " , " Español " , " Français " , " Hrvatski " , " Magyar " , " Italiano " , " Lietuvių " , " mannol " , " Nederlands " , " Pirate " , " Polski " , " Português " , " Русский " , " Slovenščina " , " Suomi " , " Svenska " , " Українська " , " 简体中文 " } ;
static QStringList timeFormats = { " hh:mm AP " , " hh:mm " , " hh:mm:ss AP " , " hh:mm:ss " } ;
static const QStringList timeFormats = { " hh:mm AP " , " hh:mm " , " hh:mm:ss AP " , " hh:mm:ss " } ;
// http://doc.qt.io/qt-4.8/qdate.html#fromString
static const QStringList dateFormats = { " dd-MM-yyyy " , " d-MM-yyyy " , " dddd d-MM-yyyy " , " dddd d-MM " , " dddd dd MMMM " } ;
GeneralForm : : GeneralForm ( SettingsWidget * myParent ) :
GenericForm ( tr ( " General " ) , QPixmap ( " :/img/settings/general.png " ) )
{
@ -98,15 +101,25 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
@@ -98,15 +101,25 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
bodyUI - > emoticonSize - > setValue ( Settings : : getInstance ( ) . getEmojiFontPointSize ( ) ) ;
QStringList timestamps ;
timestamps < < QString ( " %1 - %2 " ) . arg ( timeFormats [ 0 ] , QTime : : currentTime ( ) . toString ( timeFormats [ 0 ] ) )
< < QString ( " %1 - %2 " ) . arg ( timeFormats [ 1 ] , QTime : : currentTime ( ) . toString ( timeFormats [ 1 ] ) )
< < QString ( " %1 - %2 " ) . arg ( timeFormats [ 2 ] , QTime : : currentTime ( ) . toString ( timeFormats [ 2 ] ) )
< < QString ( " %1 - %2 " ) . arg ( timeFormats [ 3 ] , QTime : : currentTime ( ) . toString ( timeFormats [ 3 ] ) ) ;
foreach ( QString timestamp , timeFormats ) {
timestamps < < QString ( " %1 - %2 " ) . arg ( timestamp , QTime : : currentTime ( ) . toString ( timestamp ) ) ;
}
bodyUI - > timestamp - > addItems ( timestamps ) ;
QStringList datestamps ;
foreach ( QString datestamp , dateFormats ) {
datestamps < < QString ( " %1 - %2 " ) . arg ( datestamp , QDate : : currentDate ( ) . toString ( datestamp ) ) ;
}
bodyUI - > dateFormats - > addItems ( datestamps ) ;
bodyUI - > timestamp - > setCurrentText ( QString ( " %1 - %2 " ) . arg ( Settings : : getInstance ( ) . getTimestampFormat ( ) ,
QTime : : currentTime ( ) . toString ( Settings : : getInstance ( ) . getTimestampFormat ( ) ) )
) ; //idiot proof enough?
) ;
bodyUI - > dateFormats - > setCurrentText ( QString ( " %1 - %2 " ) . arg ( Settings : : getInstance ( ) . getDateFormat ( ) ,
QDate : : currentDate ( ) . toString ( Settings : : getInstance ( ) . getDateFormat ( ) ) )
) ;
bodyUI - > autoAwaySpinBox - > setValue ( Settings : : getInstance ( ) . getAutoAwayTime ( ) ) ;
bodyUI - > cbEnableUDP - > setChecked ( ! Settings : : getInstance ( ) . getForceTCP ( ) ) ;
@ -142,6 +155,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
@@ -142,6 +155,7 @@ GeneralForm::GeneralForm(SettingsWidget *myParent) :
connect ( bodyUI - > themeColorCBox , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( onThemeColorChanged ( int ) ) ) ;
connect ( bodyUI - > emoticonSize , SIGNAL ( editingFinished ( ) ) , this , SLOT ( onEmoticonSizeChanged ( ) ) ) ;
connect ( bodyUI - > timestamp , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( onTimestampSelected ( int ) ) ) ;
connect ( bodyUI - > dateFormats , SIGNAL ( currentIndexChanged ( int ) ) , this , SLOT ( onDateFormatSelected ( int ) ) ) ;
//connection
connect ( bodyUI - > cbEnableIPv6 , & QCheckBox : : stateChanged , this , & GeneralForm : : onEnableIPv6Updated ) ;
connect ( bodyUI - > cbEnableUDP , & QCheckBox : : stateChanged , this , & GeneralForm : : onUDPUpdated ) ;
@ -242,6 +256,11 @@ void GeneralForm::onTimestampSelected(int index)
@@ -242,6 +256,11 @@ void GeneralForm::onTimestampSelected(int index)
Settings : : getInstance ( ) . setTimestampFormat ( timeFormats . at ( index ) ) ;
}
void GeneralForm : : onDateFormatSelected ( int index )
{
Settings : : getInstance ( ) . setDateFormat ( dateFormats . at ( index ) ) ;
}
void GeneralForm : : onAutoAwayChanged ( )
{
int minutes = bodyUI - > autoAwaySpinBox - > value ( ) ;