summaryrefslogtreecommitdiff
path: root/noncore/games/kbill/UI.cpp
Unidiff
Diffstat (limited to 'noncore/games/kbill/UI.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kbill/UI.cpp31
1 files changed, 15 insertions, 16 deletions
diff --git a/noncore/games/kbill/UI.cpp b/noncore/games/kbill/UI.cpp
index 611cebf..a49c3c1 100644
--- a/noncore/games/kbill/UI.cpp
+++ b/noncore/games/kbill/UI.cpp
@@ -47,70 +47,69 @@ void UI::kill_timer() {
47void UI::initialize(int *argc, char **argv) { 47void UI::initialize(int *argc, char **argv) {
48 #ifdef KDEVER 48 #ifdef KDEVER
49 app = new KApplication(*argc, argv, "kbill"); 49 app = new KApplication(*argc, argv, "kbill");
50 #endif 50 #endif
51 app = new QPEApplication(*argc, argv); 51 app = new QPEApplication(*argc, argv);
52} 52}
53 53
54void UI::graph_init() { 54void UI::graph_init() {
55 pix = new QPixmap(Game::scrwidth, Game::scrheight); 55 pix = new QPixmap(Game::scrwidth, Game::scrheight);
56 paint.begin(pix, field); 56 paint.begin(pix, field);
57 paint.setPen(QPen(Qt::black, 3)); 57 paint.setPen(QPen(Qt::black, 3));
58} 58}
59 59
60void UI::make_mainwin() { 60void UI::make_mainwin() {
61 main = new KBill(); 61 main = new KBill();
62 app->showMainWidget(main,true); 62 app->showMainWidget(main,true);
63 main->showMaximized(); 63 main->showMaximized();
64 field = main->getField(); 64 field = main->getField();
65} 65}
66 66
67void UI::popup_dialog (int dialog) { 67void UI::popup_dialog (int dialog) {
68 kill_timer(); 68 kill_timer();
69 switch (dialog) { 69 switch (dialog) {
70 case Game::ENDGAME: 70 case Game::ENDGAME:
71 QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr)); 71 QMessageBox::message(("Endgame"), QT_TR_NOOP(endgamestr));
72 break; 72 break;
73 case Game::HIGHSCORE: 73 case Game::HIGHSCORE:
74 //QMessageBox::message(("HighScore"), highscorestr); 74 break;
75 break; 75 case Game::ENTERNAME:
76 case Game::ENTERNAME: { 76 {
77 InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr)); 77 InputBox b(main, 0, ("Enter Name"), QT_TR_NOOP(enternamestr));
78 bool state = b.exec() == 2; 78 bool state = b.exec() == 2;
79 char str[20], *nl; 79 char str[20], *nl;
80 strcpy(str, b.getText()); 80 strncpy(str, b.getText(), 19);
81 if (!str[0] || state) 81 if (!str[0] || state)
82 strcpy(str, "Anonymous"); 82 strcpy(str, "Anonymous");
83 else if ((nl = strchr(str, '\n'))) 83 else if ((nl = strchr(str, '\n')))
84 *nl = '\0'; 84 *nl = '\0';
85 if (strlen(str) > 20) 85 if (strlen(str) > 19)
86 str[20] = 0; /* truncate string if too long */ 86 str[19] = '\0'; /* truncate/terminate the string if it is too long */
87 // scores.recalc(str); 87 }
88 } 88 break;
89 break;
90 case Game::SCORE: 89 case Game::SCORE:
91 QMessageBox::message(("Score"), scorestr); 90 QMessageBox::message(("Score"), scorestr);
92 break; 91 break;
93 } 92 }
94 restart_timer(); 93 restart_timer();
95} 94}
96 95
97/*********************/ 96/*********************/
98/* Graphics routines */ 97/* Graphics routines */
99/*********************/ 98/*********************/
100 99
101void UI::set_cursor(int cursor) { 100void UI::set_cursor(int cursor) {
102 QCursor *cur; 101 QCursor *cur;
103 switch (cursor) { 102 switch (cursor) {
104 case Game::BUCKETC: 103 case Game::BUCKETC:
105 cur = bucket.cursor.cursor; 104 cur = bucket.cursor.cursor;
106 break; 105 break;
107 case Game::DOWNC: 106 case Game::DOWNC:
108 cur = downcursor.cursor; 107 cur = downcursor.cursor;
109 break; 108 break;
110 case Game::DEFAULTC: 109 case Game::DEFAULTC:
111 cur = defaultcursor.cursor; 110 cur = defaultcursor.cursor;
112 break; 111 break;
113 default: 112 default:
114 cur = OS.cursor[cursor].cursor; 113 cur = OS.cursor[cursor].cursor;
115 } 114 }
116 field->setCursor(*cur); 115 field->setCursor(*cur);