~ubuntu-branches/ubuntu/wily/wpasupplicant/wily

« back to all changes in this revision

Viewing changes to wpa_supplicant/wpa_gui-qt4/signalbar.cpp

  • Committer: Package Import Robot
  • Author(s): Stefan Lippers-Hollmann, Kel Modderman, Stefan Lippers-Hollmann
  • Date: 2011-09-26 23:30:00 UTC
  • mfrom: (5.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20110926233000-hcrc2cbhueypqfbb
Tags: 0.7.3-4
[ Kel Modderman ]
* Support /run/sendsigs.omit.d/ (Closes: #633040):
  - depend on initscripts (>= 2.88dsf-13.3)
  - create new omission pid files in /run/sendsigs.omit.d/ unconditionally
  - migrate existing omission pid files from /lib/init/rw/ to
    /run/sendsigs.omit.d/
* ACK NMU (Closes: #610931)
  - add wpasupplicant-udeb
  - build against libnl3
* Improve integration of the udeb addition with existing debian/rules:
  - build the required binary in the build target in similar way to standard
    package build
  - install binary manually in dh_auto_install override rather than
    wpasupplicant-udeb.install to handle renaming of binary
  - sync udeb CFLAGS with the standard build
  - allow potential for non-linux udebs, add a kfreebsd udeb configuration
    snippet
* Filter the numerous hyphen-used-as-minus-sign informational messages
  from lintian output.
* Add preferred options to debian/source/local-options to assist with quilt
  patch management.
* Add patch for wpa_gui-qt4 which displays scan results signal strength in
  dBm with bar indicator. (Closes: #630681)

[ Stefan Lippers-Hollmann ]
* make wpasupplicant-udeb arch=any, an initial kfreebsd udeb config is now
  provided as well.
* use Package-Type instead of XC-Package-Type for wpasupplicant-udeb,
  dpkg-dev >1.15.7 is available in squeeze.
* add a dependency on ${misc:Depends} for the udeb package as well.
* adapt debian/copyright to recent changes (r174) in DEP-5 and use the new
  anonscm URL.
* don't use /run/sendsigs.omit.d/ if it hasn't already been created by
  mountkernfs.sh (e.g. when using systemd), thanks to Michael Biebl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * wpa_gui - SignalBar class
 
3
 * Copyright (c) 2011, Kel Modderman <kel@otaku42.de>
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License version 2 as
 
7
 * published by the Free Software Foundation.
 
8
 *
 
9
 * Alternatively, this software may be distributed under the terms of BSD
 
10
 * license.
 
11
 *
 
12
 * See README and COPYING for more details.
 
13
 */
 
14
 
 
15
#include <cstdio>
 
16
#include <qapplication.h>
 
17
 
 
18
#include "signalbar.h"
 
19
 
 
20
 
 
21
SignalBar::SignalBar(QObject *parent)
 
22
        : QStyledItemDelegate(parent)
 
23
{
 
24
}
 
25
 
 
26
 
 
27
SignalBar::~SignalBar()
 
28
{
 
29
}
 
30
 
 
31
 
 
32
void SignalBar::paint(QPainter *painter,
 
33
                      const QStyleOptionViewItem &option,
 
34
                      const QModelIndex &index) const
 
35
{
 
36
        QStyleOptionProgressBar opts;
 
37
        int signal;
 
38
 
 
39
        if (index.column() != 3) {
 
40
                QStyledItemDelegate::paint(painter, option, index);
 
41
                return;
 
42
        }
 
43
 
 
44
        if (index.data().toInt() > 0)
 
45
                signal = 0 - (256 - index.data().toInt());
 
46
        else
 
47
                signal = index.data().toInt();
 
48
 
 
49
        opts.minimum = -95;
 
50
        opts.maximum = -35;
 
51
        if (signal < opts.minimum)
 
52
                opts.progress = opts.minimum;
 
53
        else if (signal > opts.maximum)
 
54
                opts.progress = opts.maximum;
 
55
        else
 
56
                opts.progress = signal;
 
57
 
 
58
        opts.text = QString::number(signal) + " dBm";
 
59
        opts.textVisible = true;
 
60
        opts.rect = option.rect;
 
61
 
 
62
        QApplication::style()->drawControl(QStyle::CE_ProgressBar,
 
63
                                           &opts, painter);
 
64
}