~ubuntu-branches/ubuntu/maverick/qgo/maverick

« back to all changes in this revision

Viewing changes to src/tip.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Martin A. Godisch
  • Date: 2005-01-01 23:07:10 UTC
  • Revision ID: james.westby@ubuntu.com-20050101230710-fhng6yidm47xlb2i
Tags: upstream-1.0.0-r2
ImportĀ upstreamĀ versionĀ 1.0.0-r2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
* tip.cpp
 
3
*/
 
4
 
 
5
#include "tip.h"
 
6
#include "board.h"
 
7
#include "qgo.h"
 
8
 
 
9
/*
 
10
* Tip
 
11
*/
 
12
 
 
13
Tip::Tip(QWidget *parent)
 
14
: QToolTip(parent)
 
15
{
 
16
}
 
17
 
 
18
Tip::~Tip()
 
19
{
 
20
}
 
21
 
 
22
void Tip::maybeTip(const QPoint &pos)
 
23
{
 
24
        if (!setting->readBoolEntry("BOARD_COORDS_TIP"))
 
25
                return;
 
26
        
 
27
        int x = ((Board*)parentWidget())->getCurrentX(),
 
28
                y = ((Board*)parentWidget())->getCurrentY();
 
29
        
 
30
        if (x == -1 || y == -1)
 
31
                return;
 
32
        
 
33
        tip(QRect(pos.x(), pos.y(), 1, 1),
 
34
                QString(QChar(static_cast<const char>('A' + (x<9?x:x+1) - 1))) +       // A -> T (skip I)
 
35
                " " + QString::number(((Board*)parentWidget())->getBoardSize()-y+1));  // 19 -> 1
 
36
}
 
37
 
 
38
 
 
39
/*
 
40
* StatusTip
 
41
*/
 
42
 
 
43
StatusTip::StatusTip(QWidget *parent)
 
44
: QLabel(parent)
 
45
{
 
46
        setAlignment(AlignCenter | SingleLine);
 
47
}
 
48
 
 
49
StatusTip::~StatusTip()
 
50
{
 
51
}
 
52
 
 
53
void StatusTip::slotStatusTipCoords(int x, int y, int board_size)
 
54
{
 
55
        emit clearStatusBar();
 
56
        
 
57
        setText(" " + QString(QChar(static_cast<const char>('A' + (x<9?x:x+1) - 1))) +       // A -> T (skip I)
 
58
                " " + QString::number(board_size-y+1) + " ");                                // 19 -> 1
 
59
}