From 29b50d195f91ee5131805a0ca9fe45ab77655c8a Mon Sep 17 00:00:00 2001 From: Slávek Banko Date: Wed, 21 Aug 2013 21:26:05 +0200 Subject: Initial import of klcddimmer 0.3 --- src/brightnesschooserimpl.h | 82 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 src/brightnesschooserimpl.h (limited to 'src/brightnesschooserimpl.h') diff --git a/src/brightnesschooserimpl.h b/src/brightnesschooserimpl.h new file mode 100644 index 0000000..2bf2fa9 --- /dev/null +++ b/src/brightnesschooserimpl.h @@ -0,0 +1,82 @@ +/*************************************************************************** + * Copyright (C) 2005 by Lorenzo Bettini * + * http://www.lorenzobettini.it * + * * + * 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., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#ifndef BRIGHTNESSCHOOSERIMPL_H +#define BRIGHTNESSCHOOSERIMPL_H + +#include + +class QProcess; + +/** +Implementation slots for BrightnessChooser + +@author Lorenzo Bettini, http://www.lorenzobettini.it,, +*/ +class BrightnessChooserImpl : public BrightnessChooser +{ +Q_OBJECT +public: + BrightnessChooserImpl(QWidget *parent = 0, const char *name = 0); + + ~BrightnessChooserImpl(); + + /** + * Updates the slider properties according to the global + * properties. + */ + void updateSlider(); + + /** + * Returns the current value of brightness. + * @return + */ + const QString getValue(); + + /** + * Sets the current value of brightness + * @param val + */ + void setValue(const QString &val); + + /// retrieve the current brightness + void getBrightness(); + + protected slots: + void updateBrightness(); + void updateValue(int); + void readFromStderr(); + void readFromStdout(); + void readValueFromStdout(); + void procExited(); + + private: + /// process instance used to adjust brightness + QProcess *proc; + + signals: + void valueUpdated(); + + protected: + /// to intercept the Enter key press and direct it to OK button + void keyPressEvent( QKeyEvent * ); + +}; + +#endif -- cgit v1.2.3