2009-09-16 06:09:31 +00:00
|
|
|
#ifndef OxygenExceptionListWidget_h
|
|
|
|
#define OxygenExceptionListWidget_h
|
2009-08-24 16:15:14 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-09-15 07:12:54 +00:00
|
|
|
// OxygenExceptionListWidget.h
|
2009-08-24 16:15:14 +00:00
|
|
|
// -------------------
|
2009-09-09 00:55:55 +00:00
|
|
|
//
|
2009-08-25 04:15:13 +00:00
|
|
|
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
2009-08-24 16:15:14 +00:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
// of this software and associated documentation files (the "Software"), to
|
|
|
|
// deal in the Software without restriction, including without limitation the
|
|
|
|
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
// sell copies of the Software, and to permit persons to whom the Software is
|
|
|
|
// furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
2009-09-09 00:55:55 +00:00
|
|
|
// IN THE SOFTWARE.
|
2009-08-24 16:15:14 +00:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
#include <KPushButton>
|
|
|
|
#include <QTreeView>
|
|
|
|
#include <KDialog>
|
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
#include "oxygenexceptionmodel.h"
|
|
|
|
#include "../oxygenexceptionlist.h"
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
//! QDialog used to commit selected files
|
2009-09-15 07:12:54 +00:00
|
|
|
namespace Oxygen
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-15 07:12:54 +00:00
|
|
|
class OxygenExceptionListWidget: public QWidget
|
2009-08-22 08:24:06 +00:00
|
|
|
{
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! Qt meta object
|
|
|
|
Q_OBJECT
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
public:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! constructor
|
2009-09-16 06:09:31 +00:00
|
|
|
explicit OxygenExceptionListWidget( QWidget* = 0, OxygenConfiguration default_configuration = OxygenConfiguration() );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! set exceptions
|
2009-09-15 07:12:54 +00:00
|
|
|
void setExceptions( const OxygenExceptionList& );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! get exceptions
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenExceptionList exceptions( void ) const;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-30 17:37:07 +00:00
|
|
|
signals:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-09-16 06:09:31 +00:00
|
|
|
//! emitted when list is changed
|
2009-08-30 17:37:07 +00:00
|
|
|
void changed( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
protected:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! list
|
|
|
|
QTreeView& _list() const
|
|
|
|
{ return *list_; }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! model
|
2009-09-15 07:12:54 +00:00
|
|
|
const OxygenExceptionModel& _model() const
|
2009-08-22 08:24:06 +00:00
|
|
|
{ return model_; }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! model
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenExceptionModel& _model()
|
2009-08-22 08:24:06 +00:00
|
|
|
{ return model_; }
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
protected slots:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! update button states
|
|
|
|
virtual void _updateButtons( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! add
|
|
|
|
virtual void _add( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! edit
|
|
|
|
virtual void _edit( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
|
|
|
//! remove
|
2009-08-22 08:24:06 +00:00
|
|
|
virtual void _remove( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! toggle
|
|
|
|
virtual void _toggle( const QModelIndex& );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! move up
|
|
|
|
virtual void _up( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! move down
|
|
|
|
virtual void _down( void );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
private:
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! resize columns
|
|
|
|
void _resizeColumns( void ) const;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! check exception
|
2009-09-15 07:12:54 +00:00
|
|
|
bool _checkException( OxygenException& );
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! default configuration
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenConfiguration default_configuration_;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! list of files
|
|
|
|
QTreeView* list_;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! model
|
2009-09-15 07:12:54 +00:00
|
|
|
OxygenExceptionModel model_;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! add
|
|
|
|
KPushButton* add_button_;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! edit
|
|
|
|
KPushButton* edit_button_;
|
|
|
|
|
|
|
|
//! remove
|
|
|
|
KPushButton* remove_button_;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! move up
|
|
|
|
KPushButton* up_button_;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
//! move down
|
|
|
|
KPushButton* down_button_;
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-22 08:24:06 +00:00
|
|
|
};
|
2009-09-09 00:55:55 +00:00
|
|
|
|
2009-08-24 06:27:49 +00:00
|
|
|
}
|
2009-08-22 08:24:06 +00:00
|
|
|
|
|
|
|
#endif
|