kcachegrind
configpage.h
Go to the documentation of this file.00001 /* This file is part of KCachegrind. 00002 Copyright (C) 2009 Josef Weidendorfer <Josef.Weidendorfer@gmx.de> 00003 00004 KCachegrind is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU General Public 00006 License as published by the Free Software Foundation, version 2. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; see the file COPYING. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 */ 00018 00019 /* 00020 * Base class for pages in configuration dialog 00021 */ 00022 00023 #ifndef CONFIGPAGE_H 00024 #define CONFIGPAGE_H 00025 00026 #include <QString> 00027 #include <QMap> 00028 #include <QWidget> 00029 00030 class ConfigPage: public QWidget 00031 { 00032 public: 00033 ConfigPage(QWidget* parent, QString title, QString longTitle = QString()); 00034 virtual ~ConfigPage() {} 00035 00036 QString title() { return _title; } 00037 QString longTitle() { return _longTitle; } 00038 00039 // the default implementation focuses on widget named via <names> 00040 virtual void activate(QString); 00041 00042 // called on OK; prohibits closing by returning false 00043 // an error message to show and item name to navigate to can be set 00044 virtual bool check(QString& errorMsg, QString& errorItem); 00045 virtual void accept(); 00046 00047 protected: 00048 QString inRangeError(int, int); 00049 00050 QMap<QString, QWidget*> _names; 00051 00052 private: 00053 QString _title; 00054 QString _longTitle; 00055 }; 00056 00057 #endif // CONFIGPAGE
KDE 4.5 API Reference