| Home · All Classes · Main Classes · Deprecated |
00001 /*************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of libmeegotouch. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 00020 #include <mtheme.h> 00021 00022 #include "mprogressindicator.h" 00023 #include "mprogressindicator_p.h" 00024 00025 #include "mwidgetcreator.h" 00026 M_REGISTER_WIDGET(MProgressIndicator) 00027 00028 const MTheme::ViewType MProgressIndicator::spinnerType = "spinner"; 00029 const MTheme::ViewType MProgressIndicator::barType = "bar"; 00030 00031 00032 MProgressIndicatorPrivate::MProgressIndicatorPrivate() 00033 { 00034 } 00035 00036 MProgressIndicatorPrivate::~MProgressIndicatorPrivate() 00037 { 00038 } 00039 00040 void MProgressIndicatorPrivate::init() 00041 { 00042 } 00043 00044 MProgressIndicator::MProgressIndicator(MProgressIndicatorPrivate *dd, MProgressIndicatorModel *model, QGraphicsItem *parent) 00045 : MWidgetController(dd, model, parent) 00046 { 00047 Q_D(MProgressIndicator); 00048 00049 d->init(); 00050 } 00051 00052 MProgressIndicator::MProgressIndicator(QGraphicsItem *parent, const QString &viewType) 00053 : MWidgetController(new MProgressIndicatorPrivate, new MProgressIndicatorModel, parent) 00054 { 00055 setViewType(viewType); 00056 Q_D(MProgressIndicator); 00057 00058 d->init(); 00059 } 00060 00061 MProgressIndicator::~MProgressIndicator() 00062 { 00063 } 00064 00065 00066 void MProgressIndicator::reset() 00067 { 00068 setValue(minimum()); 00069 setUnknownDuration(false); 00070 } 00071 00072 00073 void MProgressIndicator::setRange(int minimum, int maximum) 00074 { 00075 model()->setMinimum(minimum); 00076 model()->setMaximum(qMax(minimum, maximum)); 00077 if (model()->value() < model()->minimum() || model()->value() > model()->maximum()) 00078 reset(); 00079 } 00080 00081 void MProgressIndicator::setValue(int value) 00082 { 00083 if (model()->value() == value) 00084 return; 00085 00086 if ((value > model()->maximum()) || (value < model()->minimum())) 00087 return; 00088 00089 model()->setValue(value); 00090 emit valueChanged(value); 00091 } 00092 00093 int MProgressIndicator::value() const 00094 { 00095 return model()->value(); 00096 } 00097 00098 00099 void MProgressIndicator::setMinimum(int minimum) 00100 { 00101 setRange(minimum, qMax(maximum(), minimum)); 00102 } 00103 00104 00105 int MProgressIndicator::minimum() const 00106 { 00107 return model()->minimum(); 00108 } 00109 00110 00111 void MProgressIndicator::setMaximum(int maximum) 00112 { 00113 setRange(qMin(minimum(), maximum), maximum); 00114 } 00115 00116 00117 int MProgressIndicator::maximum() const 00118 { 00119 return model()->maximum(); 00120 } 00121 00122 00123 void MProgressIndicator::setUnknownDuration(bool unknownDuration) 00124 { 00125 model()->setUnknownDuration(unknownDuration); 00126 } 00127 00128 00129 bool MProgressIndicator::unknownDuration() const 00130 { 00131 return model()->unknownDuration(); 00132 } 00133
| Copyright © 2010 Nokia Corporation | Generated on Thu Nov 4 2010 18:14:21 (PDT) Doxygen 1.7.1 |
MeeGo Touch |