File indexing completed on 2024-06-23 05:28:18

0001 /*
0002  * Button representing user's Avatar
0003  *
0004  * Copyright (C) 2011  Martin Klapetek <martin.klapetek@gmail.com>
0005  * Copyright (C) 2011, 2012 David Edmundson <kde@davidedmundson.co.uk>
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Lesser General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2.1 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public
0018  * License along with this library; if not, write to the Free Software
0019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
0020  */
0021 
0022 #ifndef SELECTIMAGEBUTTON_H
0023 #define SELECTIMAGEBUTTON_H
0024 
0025 #include <QtGui/QToolButton>
0026 
0027 class SelectImageButton : public QToolButton
0028 {
0029     Q_OBJECT
0030     Q_PROPERTY(QString imagePath READ imagePath WRITE setImagePath NOTIFY imagePathChanged USER true)
0031 public:
0032     SelectImageButton(QWidget* parent = 0);
0033     virtual ~SelectImageButton();
0034 
0035     //we use QString rather that KUrl because it seems to work better with KConfigXT
0036     void setImagePath(const QString &imagePath);
0037     QString imagePath() const;
0038 
0039 Q_SIGNALS:
0040     void imagePathChanged(QString);
0041 
0042 private Q_SLOTS:
0043     void onLoadImageFromFile();
0044     void onClearImage();
0045 
0046 private:
0047     QString m_imagePath;
0048 };
0049 
0050 #endif  //AVATAR_BUTTON_H