Back to index

kdeartwork  4.3.2
kpartsaver.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001 Stefan Schimanski <1Stein@gmx.de>
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public
00015  * License along with this program; if not, write to the Free
00016  * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00017  */
00018 
00019 #ifndef KPARTSAVER_H_INCLUDED
00020 #define KPARTSAVER_H_INCLUDED
00021 
00022 #include <kscreensaver.h>
00023 
00024 #include "ui_configwidget.h"
00025 #include <QList>
00026 class QTimer;
00027 class QLabel;
00028 namespace KParts { class ReadOnlyPart; }
00029 
00030 class ConfigWidget : public QDialog, public Ui::ConfigWidget
00031 {
00032 public:
00033   ConfigWidget( QWidget *parent ) : QDialog( parent ) {
00034     setupUi( this );
00035   }
00036 };
00037 
00038 
00039 class SaverConfig : public ConfigWidget {
00040 Q_OBJECT
00041 
00042  public:
00043     SaverConfig( QWidget* parent = 0);
00044     ~SaverConfig();
00045 
00046  protected slots:
00047     void apply();
00048     void add();
00049     void remove();
00050     void select();
00051     void up();
00052     void down();
00053 };
00054 
00055 
00056 class KPartSaver : public KScreenSaver {
00057 Q_OBJECT
00058 
00059  public:
00060     KPartSaver( WId id=0 );
00061     virtual ~KPartSaver();
00062 
00063  public slots:
00064     void next( bool random );
00065     void queue( const KUrl &url );
00066     void timeout();
00067     void closeUrl();
00068 
00069  protected:
00070     struct Medium {
00071        KUrl url;
00072        bool failed;
00073         inline bool operator==(const Medium& other) { return url == other.url; }
00074         inline bool operator!=(const Medium& other) { return !(*this == other); }
00075     };
00076 
00077     bool openUrl(  const KUrl& url );
00078 
00079     QList<Medium> m_media;
00080     QTimer *m_timer;
00081     KParts::ReadOnlyPart *m_part;
00082     int m_current;
00083 
00084     bool m_single;
00085     bool m_random;
00086     int m_delay;
00087     QStringList m_files;
00088     QLabel *m_back;
00089 };
00090 
00091 #endif