KWeather XDG icon names and icon theme support #18
feat/kweather-std-icons
into master
2 years ago
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 9.9 KiB |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -1,15 +1,15 @@
|
||||
[Desktop Entry]
|
||||
Icon=configure
|
||||
Icon=kicker
|
||||
Type=Service
|
||||
X-TDE-ServiceTypes=TDECModule
|
||||
|
||||
X-TDE-ModuleType=Library
|
||||
X-TDE-Library=weather
|
||||
X-TDE-FactoryName=weather
|
||||
X-TDE-Library=weatherapplet
|
||||
X-TDE-FactoryName=weatherapplet
|
||||
X-TDE-ParentApp=weather_panelapplet
|
||||
X-TDE-ParentComponents=weather_panelapplet
|
||||
|
||||
Name=Display
|
||||
Comment=Display Setup
|
||||
Keywords=kweather; weather; configure; settings; display;
|
||||
Name=Applet
|
||||
Comment=Applet Config
|
||||
Keywords=kweather; weather; configure; settings; display; applet;
|
||||
X-DocPath=kweather?anchor=configuring-kweather
|
@ -1,72 +1,151 @@
|
||||
/*
|
||||
This file is part of KWeather.
|
||||
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
/*
|
||||
This file is part of KWeather.
|
||||
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#include <tqbuttongroup.h>
|
||||
#include <tqcheckbox.h>
|
||||
#include <tqlabel.h>
|
||||
#include <tqlayout.h>
|
||||
|
||||
#include <tdeaboutdata.h>
|
||||
#include <tdeapplication.h>
|
||||
#include <tdeconfig.h>
|
||||
#include <kdebug.h>
|
||||
#include <tdelocale.h>
|
||||
#include <kurlrequester.h>
|
||||
#include <kcombobox.h>
|
||||
#include <kcolorbutton.h>
|
||||
#include <dcopclient.h>
|
||||
#include <dcopref.h>
|
||||
|
||||
#include "serviceconfigwidget.h"
|
||||
#include "dockwidget.h"
|
||||
#include "serviceconfig.h"
|
||||
|
||||
#include "kcmweatherservice.h"
|
||||
#include "weatherservice_stub.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
KDE_EXPORT TDECModule *create_weatherservice( TQWidget *parent, const char * ) {
|
||||
return new KCMWeatherService( parent, "kweather" );
|
||||
}
|
||||
KDE_EXPORT TDECModule *create_weatherservice( TQWidget *parent, const char * )
|
||||
{
|
||||
return new KCMWeatherService( parent, "kweather" );
|
||||
}
|
||||
}
|
||||
|
||||
KCMWeatherService::KCMWeatherService( TQWidget *parent, const char *name )
|
||||
: TDECModule( parent, name )
|
||||
: TDECModule( parent, name )
|
||||
{
|
||||
TQVBoxLayout *layout = new TQVBoxLayout( this );
|
||||
mWidget = new ServiceConfigWidget( this );
|
||||
mWeatherService = new WeatherService_stub( "KWeatherService",
|
||||
"WeatherService" );
|
||||
TQVBoxLayout *layout = new TQVBoxLayout( this );
|
||||
mWidget = new serviceConfig( this );
|
||||
|
||||
// not needed, as a change immediately changes the service
|
||||
//connect(mWidget, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
|
||||
layout->addWidget( mWidget );
|
||||
layout->addStretch();
|
||||
|
||||
layout->addWidget( mWidget );
|
||||
TDEAboutData *about = new TDEAboutData( "kcmweatherservice",
|
||||
I18N_NOOP( "KWeather Configure Dialog" ),
|
||||
0, 0, TDEAboutData::License_GPL,
|
||||
I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
|
||||
load();
|
||||
connect( mWidget->m_enableLog, TQT_SIGNAL( toggled( bool ) ),
|
||||
TQT_SLOT( enableLogWidgets( bool ) ) );
|
||||
connect( mWidget->m_iconTheme, TQT_SIGNAL( released( int ) ),
|
||||
TQT_SLOT( changed() ) );
|
||||
|
||||
about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
|
||||
setAboutData(about);
|
||||
TDEAboutData *about = new TDEAboutData(
|
||||
I18N_NOOP( "kcmweatherservice" ),
|
||||
I18N_NOOP( "KWeather Configure Dialog" ),
|
||||
0, 0, TDEAboutData::License_GPL,
|
||||
I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
|
||||
|
||||
about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
|
||||
setAboutData(about);
|
||||
}
|
||||
|
||||
KCMWeatherService::~KCMWeatherService()
|
||||
{
|
||||
delete mWeatherService;
|
||||
}
|
||||
|
||||
void KCMWeatherService::enableLogWidgets( bool value )
|
||||
{
|
||||
mWidget->m_logFile->setEnabled( value );
|
||||
mWidget->m_labelLogFile->setEnabled( value );
|
||||
|
||||
emit changed( true );
|
||||
}
|
||||
|
||||
void KCMWeatherService::load()
|
||||
{
|
||||
kdDebug() << "Load" << endl;
|
||||
TDEConfig config( "weather_panelappletrc" );
|
||||
|
||||
config.setGroup( "General Options" );
|
||||
bool enabled = config.readBoolEntry( "logging", false );
|
||||
mWidget->m_enableLog->setChecked( enabled );
|
||||
enableLogWidgets( enabled );
|
||||
|
||||
mWidget->m_logFile->setURL( config.readPathEntry( "log_file_name" ) );
|
||||
|
||||
mUseIconTheme = config.readBoolEntry("use_icon_theme", true);
|
||||
mWidget->m_iconTheme->setButton( mUseIconTheme ? 0 : 1 );
|
||||
|
||||
emit changed( false );
|
||||
}
|
||||
|
||||
void KCMWeatherService::save()
|
||||
{
|
||||
kdDebug() << "Save" << endl;
|
||||
TDEConfig config( "weather_panelappletrc" );
|
||||
|
||||
config.setGroup( "General Options" );
|
||||
config.writeEntry( "logging", mWidget->m_enableLog->isChecked() );
|
||||
config.writeEntry( "log_file_name", mWidget->m_logFile->url() );
|
||||
|
||||
mUseIconTheme = (mWidget->m_iconTheme->selectedId() == 0);
|
||||
config.writeEntry( "use_icon_theme", mUseIconTheme );
|
||||
updateIconTheme(mUseIconTheme);
|
||||
|
||||
config.sync();
|
||||
|
||||
emit changed( false );
|
||||
}
|
||||
|
||||
void KCMWeatherService::defaults()
|
||||
{
|
||||
mWidget->m_enableLog->setChecked( false );
|
||||
enableLogWidgets( false );
|
||||
mWidget->m_logFile->setURL( "" );
|
||||
|
||||
mWidget->m_iconTheme->setButton(0);
|
||||
|
||||
emit changed( true );
|
||||
}
|
||||
|
||||
void KCMWeatherService::updateIconTheme( bool useIconTheme )
|
||||
{
|
||||
DCOPRef ws( "KWeatherService", "WeatherService" );
|
||||
DCOPReply reply = ws.call( "useIconTheme", useIconTheme );
|
||||
if( ! reply.isValid() )
|
||||
{
|
||||
kdDebug(12004) << "[kcmweatherservice::updateIconTheme] DCOP call failed" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
#include "kcmweatherservice.moc"
|
||||
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
This file is part of KWeather.
|
||||
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#include <tqlayout.h>
|
||||
|
||||
#include <tdeaboutdata.h>
|
||||
#include <kdebug.h>
|
||||
#include <tdelocale.h>
|
||||
|
||||
#include "stationsconfigwidget.h"
|
||||
|
||||
#include "kcmweatherstations.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
KDE_EXPORT TDECModule *create_weatherstations( TQWidget *parent, const char * ) {
|
||||
return new KCMWeatherStations( parent, "kweather" );
|
||||
}
|
||||
}
|
||||
|
||||
KCMWeatherStations::KCMWeatherStations( TQWidget *parent, const char *name )
|
||||
: TDECModule( parent, name )
|
||||
{
|
||||
TQVBoxLayout *layout = new TQVBoxLayout( this );
|
||||
mWidget = new StationsConfigWidget( this );
|
||||
|
||||
// not needed, as a change immediately changes the service
|
||||
//connect(mWidget, TQT_SIGNAL(changed(bool)), this, TQT_SIGNAL(changed(bool)));
|
||||
|
||||
layout->addWidget( mWidget );
|
||||
TDEAboutData *about = new TDEAboutData( "kcmweatherstations",
|
||||
I18N_NOOP( "KWeather Configure Dialog" ),
|
||||
0, 0, TDEAboutData::License_GPL,
|
||||
I18N_NOOP( "(c), 2003 Tobias Koenig" ) );
|
||||
|
||||
about->addAuthor( "Tobias Koenig", 0, "tokoe@kde.org" );
|
||||
setAboutData(about);
|
||||
}
|
||||
|
||||
void KCMWeatherStations::load()
|
||||
{
|
||||
}
|
||||
|
||||
void KCMWeatherStations::save()
|
||||
{
|
||||
}
|
||||
|
||||
void KCMWeatherStations::defaults()
|
||||
{
|
||||
}
|
||||
|
||||
#include "kcmweatherstations.moc"
|
@ -0,0 +1,16 @@
|
||||
[Desktop Entry]
|
||||
Icon=kweather
|
||||
Type=Service
|
||||
X-TDE-ServiceTypes=TDECModule
|
||||
|
||||
X-TDE-ModuleType=Library
|
||||
X-TDE-Library=weatherstations
|
||||
X-TDE-FactoryName=weatherstations
|
||||
X-TDE-ParentApp=weather_panelapplet
|
||||
X-TDE-ParentComponents=weather_panelapplet,kontact_weatherplugin
|
||||
X-TDE-CfgDlgHierarchy=KontactSummary
|
||||
|
||||
Name=Stations
|
||||
Comment=Weather Stations Config
|
||||
Keywords=kweather; weather service; configure; settings; stations;
|
||||
X-DocPath=kweather?anchor=weather-service
|
@ -0,0 +1,47 @@
|
||||
/*
|
||||
This file is part of KWeather.
|
||||
Copyright (c) 2003 Tobias Koenig <tokoe@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
As a special exception, permission is given to link this program
|
||||
with any edition of TQt, and distribute the resulting executable,
|
||||
without including the source code for TQt in the source distribution.
|
||||
*/
|
||||
|
||||
#ifndef KCMWEATHERSTATIONS_H
|
||||
#define KCMWEATHERSTATIONS_H
|
||||
|
||||
#include <tdecmodule.h>
|
||||
|
||||
class StationsConfigWidget;
|
||||
|
||||
class KCMWeatherStations : public TDECModule
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
KCMWeatherStations( TQWidget *parent = 0, const char *name = 0 );
|
||||
|
||||
virtual void load();
|
||||
virtual void save();
|
||||
virtual void defaults();
|
||||
|
||||
private:
|
||||
StationsConfigWidget *mWidget;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,198 @@
|
||||
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||
<class>serviceConfig</class>
|
||||
<author>ian reinhart geiser <geiseri@kde.org></author>
|
||||
<widget class="TQWidget">
|
||||
<property name="name">
|
||||
<cstring>serviceConfig</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>491</width>
|
||||
<height>194</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>3</hsizetype>
|
||||
<vsizetype>3</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>serviceConfig</string>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>TabFocus</enum>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="TQButtonGroup">
|
||||
<property name="name">
|
||||
<cstring>m_iconTheme</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Weather Icons</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQRadioButton">
|
||||
<property name="name">
|
||||
<cstring>m_systemIcons</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Use system theme</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="TQRadioButton">
|
||||
<property name="name">
|
||||
<cstring>m_kweatherIcons</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use classic &KWeather theme</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="TQGroupBox">
|
||||
<property name="name">
|
||||
<cstring>GroupBox1</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Logging Options</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>m_enableLog</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>E&nable logging</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>Spacer6_2</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>294</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="TQLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>m_labelLogFile</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Log f&ile:</string>
|
||||
</property>
|
||||
<property name="buddy" stdset="0">
|
||||
<cstring>m_logFile</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="KURLRequester" row="1" column="1" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>m_logFile</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>252</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Enter the logfile name.</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Enter the full path and filename to enable logging in KWeather.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer4</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>111</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</vbox>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>m_enableLog</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>m_labelLogFile</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>m_enableLog</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>m_logFile</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<includes>
|
||||
<include location="global" impldecl="in implementation">kcolorbutton.h</include>
|
||||
<include location="global" impldecl="in implementation">kcombobox.h</include>
|
||||
<include location="global" impldecl="in implementation">kdialog.h</include>
|
||||
<include location="global" impldecl="in implementation">kurlrequester.h</include>
|
||||
<include location="global" impldecl="in implementation">kpushbutton.h</include>
|
||||
<include location="global" impldecl="in implementation">klineedit.h</include>
|
||||
</includes>
|
||||
<layoutdefaults spacing="3" margin="6"/>
|
||||
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
|
||||
</UI>
|
@ -0,0 +1,460 @@
|
||||
#include <tqpair.h>
|
||||
|
||||
#include <kstandarddirs.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "weather_icon.h"
|
||||
|
||||
WeatherIconPrivate* WeatherIconPrivate::s_instance = 0;
|
||||
|
||||
WeatherIconPrivate::WeatherIconPrivate()
|
||||
{
|
||||
iconLoader = new TDEIconLoader("kweather");
|
||||
}
|
||||
|
||||
WeatherIconPrivate::~WeatherIconPrivate()
|
||||
{
|
||||
delete iconLoader;
|
||||
}
|
||||
|
||||
WeatherIconPrivate* WeatherIconPrivate::instance()
|
||||
{
|
||||
if ( s_instance == 0 )
|
||||
s_instance = new WeatherIconPrivate();
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
void WeatherIconPrivate::useIconTheme( bool use )
|
||||
{
|
||||
m_useIconTheme = use;
|
||||
}
|
||||
|
||||
bool WeatherIconPrivate::usingIconTheme()
|
||||
{
|
||||
return m_useIconTheme;
|
||||
}
|
||||
|
||||
TQPair<TQString,TQString> WeatherIconPrivate::findIcon( TQStringList fallback )
|
||||
{
|
||||
kdDebug(12006) << "[findIcon] Use icon theme? " << m_useIconTheme << endl;
|
||||
if( m_useIconTheme )
|
||||
{
|
||||
// Check in theme
|
||||
for ( TQStringList::Iterator icon = fallback.begin(); icon != fallback.end(); ++icon )
|
||||
{
|
||||
kdDebug(12006) << "[findIcon] Searching for `" << *icon << "` in theme" << endl;
|
||||
TQString iPath = iconPath(*icon, true);
|
||||
if( !( iPath.isNull() ) )
|
||||
{
|
||||
kdDebug(12006) << "[findIcon] Found `" << *icon << "` in theme: " << iPath << endl;
|
||||
return qMakePair(*icon, iPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check in kweather fallback
|
||||
for ( TQStringList::Iterator icon = fallback.begin(); icon != fallback.end(); ++icon )
|
||||
{
|
||||
kdDebug(12006) << "[findIcon] Searching for `" << *icon << "` in kweather icons" << endl;
|
||||
TQString iPath = iconPath(*icon, false);
|
||||
if( !( iPath.isNull() ) )
|
||||
{
|
||||
kdDebug(12006) << "[findIcon] Found `" << *icon << "` in kweather icons: " << iPath << endl;
|
||||
return qMakePair(*icon, iPath);
|
||||
}
|
||||
}
|
||||
return qMakePair(WeatherIcon::unknown(), iconPath(WeatherIcon::unknown()));
|
||||
}
|
||||
|
||||
TQString WeatherIconPrivate::iconPath( TQString icon, bool inTheme )
|
||||
{
|
||||
if( inTheme )
|
||||
{
|
||||
return iconLoader->iconPath(icon, TDEIcon::Desktop, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return locate( "data", "kweather/" + icon + ".png" );
|
||||
}
|
||||
}
|
||||
|
||||
TQString WeatherIconPrivate::iconPath( TQString icon )
|
||||
{
|
||||
return iconPath(icon, m_useIconTheme);
|
||||
}
|
||||
|
||||
WeatherIcon::WeatherIcon( int condition, bool night )
|
||||
{
|
||||
TQStringList fallback;
|
||||
|
||||
switch( condition )
|
||||
{
|
||||
case Sunny:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-clear-night"; //xdg, kweather
|
||||
}
|
||||
fallback << "weather-clear"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Fog:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-fog-night"; // themes, kweather
|
||||
}
|
||||
fallback << "weather-fog"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Mist:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-mist-night"; // themes, kweather
|
||||
}
|
||||
fallback << "weather-mist"; // themes, kweather
|
||||
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-fog-night"; // themes, kweather
|
||||
}
|
||||
fallback << "weather-fog"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Overcast:
|
||||
{
|
||||
fallback << "weather-overcast"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Hail:
|
||||
{
|
||||
fallback << "weather-hail"; // themes
|
||||
fallback << "weather-freezing-rain"; // themes, kweather
|
||||
fallback << "weather-snow"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case LightRain:
|
||||
{
|
||||
fallback << "weather-showers-scattered"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Sleet:
|
||||
{
|
||||
fallback << "weather-snow-rain"; // themes, kweather
|
||||
fallback << "weather-snow"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TQPair<TQString,TQString> foundIcon = WeatherIconPrivate::instance()->findIcon(fallback);
|
||||
iconName = foundIcon.first;
|
||||
iconPath = foundIcon.second;
|
||||
return;
|
||||
}
|
||||
|
||||
WeatherIcon::WeatherIcon( int condition, bool night, unsigned int strength )
|
||||
{
|
||||
TQStringList fallback;
|
||||
|
||||
switch ( condition )
|
||||
{
|
||||
case Cloudy:
|
||||
{
|
||||
switch ( strength )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-few-clouds-night"; // xdg, kweather
|
||||
}
|
||||
fallback << "weather-few-clouds"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-moderate-clouds-night"; // kweather
|
||||
}
|
||||
fallback << "weather-moderate-clouds"; // kweather
|
||||
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-few-clouds-night"; // xdg, kweather
|
||||
}
|
||||
fallback << "weather-few-clouds"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3: {
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-clouds-night"; // themes, kweather
|
||||
}
|
||||
fallback << "weather-clouds"; // themes, kweather
|
||||
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-few-clouds-night"; // xdg, kweather
|
||||
}
|
||||
fallback << "weather-few-clouds"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-ample-clouds-night"; // kweather
|
||||
}
|
||||
fallback << "weather-ample-clouds"; // kweather
|
||||
|
||||
fallback << "weather-many-clouds"; // themes, kweather
|
||||
|
||||
fallback << "weather-overcast"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 5: {
|
||||
fallback << "weather-many-clouds"; // themes, kweather
|
||||
|
||||
fallback << "weather-overcast"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
fallback << "weather-clouds"; // themes, kweather
|
||||
|
||||
fallback << "weather-few-clouds"; // xdg, kweather
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Showers:
|
||||
{
|
||||
switch ( strength )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-showers-scattered-night"; // themes, kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-showers-scattered-day"; // themes, kweather
|
||||
}
|
||||
|
||||
fallback << "weather-showers-scattered"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-showers-night"; // themes, kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-showers-day"; // themes, kweather
|
||||
}
|
||||
|
||||
fallback << "weather-showers"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3:
|
||||
default:
|
||||
{
|
||||
fallback << "weather-showers"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Snow:
|
||||
{
|
||||
switch( strength )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-snow-scattered-night"; // themes, kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-snow-scattered-day"; // themes, kweather
|
||||
}
|
||||
|
||||
fallback << "weather-snow-scattered"; // xdg, kweather
|
||||
|
||||
fallback << "weather-snow"; // workaround for some themes
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-snow-moderate-night"; // kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-snow-moderate-day"; // kweather
|
||||
}
|
||||
|
||||
fallback << "weather-snow-moderate"; // kweather
|
||||
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-snow-scattered-night"; // themes, kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-snow-scattered-day"; // themes, kweather
|
||||
}
|
||||
|
||||
fallback << "weather-snow-scattered"; // xdg, kweather
|
||||
|
||||
fallback << "weather-snow"; // workaround for some themes
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 3:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-snow-ample-night"; // kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-snow-ample-day"; // kweather
|
||||
}
|
||||
|
||||
fallback << "weather-snow-ample"; // kweather
|
||||
|
||||
|
||||
fallback << "weather-snow"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 4:
|
||||
{
|
||||
fallback << "weather-snow-scattered"; // xdg, kweather
|
||||
|
||||
fallback << "weather-snow"; // workaround for some themes
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 5:
|
||||
default:
|
||||
{
|
||||
fallback << "weather-snow"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case Thunderstorm:
|
||||
switch ( strength )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-storm-night"; // themes, kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-storm-day"; // themes, kweather
|
||||
}
|
||||
fallback << "weather-storm"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case 2:
|
||||
{
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-storm-moderate-night"; // kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-storm-moderate-day"; // kweather
|
||||
}
|
||||
fallback << "weather-storm-moderate"; // kweather
|
||||
|
||||
if( night )
|
||||
{
|
||||
fallback << "weather-storm-night"; // themes, kweather
|
||||
}
|
||||
else
|
||||
{
|
||||
fallback << "weather-storm-day"; // themes, kweather
|
||||
}
|
||||
fallback << "weather-storm"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
default:
|
||||
{
|
||||
fallback << "weather-storm"; // xdg, kweather
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
TQPair<TQString,TQString> foundIcon = WeatherIconPrivate::instance()->findIcon(fallback);
|
||||
iconName = foundIcon.first;
|
||||
iconPath = foundIcon.second;
|
||||
return;
|
||||
}
|
||||
|
||||
WeatherIcon::~WeatherIcon()
|
||||
{
|
||||
iconName = TQString::null;
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
class TDEIconLoader;
|
||||
|
||||
class WeatherIconPrivate {
|
||||
friend class WeatherIcon;
|
||||
|
||||
public:
|
||||
WeatherIconPrivate();
|
||||
~WeatherIconPrivate();
|
||||
|
||||
static WeatherIconPrivate* instance();
|
||||
|
||||
void useIconTheme( bool use );
|
||||
bool usingIconTheme();
|
||||
|
||||
TQString iconPath( TQString icon, bool inTheme );
|
||||
TQString iconPath( TQString icon );
|
||||
|
||||
private:
|
||||
static WeatherIconPrivate* s_instance;
|
||||
TDEIconLoader* iconLoader;
|
||||
bool m_useIconTheme;
|
||||
|
||||
TQPair<TQString,TQString> findIcon( TQStringList fallback );
|
||||
};
|
||||
|
||||
class WeatherIcon {
|
||||
public:
|
||||
enum SimpleCondition { Sunny, Fog, Mist, Overcast, Hail, LightRain, Sleet };
|
||||
enum RangedCondition { Cloudy, Showers, Snow, Thunderstorm };
|
||||
|
||||
WeatherIcon( int condition /* SimpleCondition */, bool night );
|
||||
WeatherIcon( int condition /* RangedCondition */, bool night, unsigned int strength );
|
||||
~WeatherIcon();
|
||||
|
||||
static TQString unknown() { return "weather-none-available"; };
|
||||
TQString name() { return iconName; }
|
||||
TQString path() { return iconPath; }
|
||||
|
||||
private:
|
||||
TQString iconName;
|
||||
TQString iconPath;
|
||||
};
|