summaryrefslogtreecommitdiffstats
path: root/kmahjongg/Preview.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /kmahjongg/Preview.cpp
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kmahjongg/Preview.cpp')
-rw-r--r--kmahjongg/Preview.cpp88
1 files changed, 44 insertions, 44 deletions
diff --git a/kmahjongg/Preview.cpp b/kmahjongg/Preview.cpp
index 11fbcdbd..5c5871bf 100644
--- a/kmahjongg/Preview.cpp
+++ b/kmahjongg/Preview.cpp
@@ -19,7 +19,7 @@
static const char * themeMagicV1_0= "kmahjongg-theme-v1.0";
-Preview::Preview(TQWidget* parent) : KDialogBase(parent), m_tiles(true)
+Preview::Preview(TQWidget* tqparent) : KDialogBase(tqparent), m_tiles(true)
{
KPushButton *loadButton;
TQGroupBox *group;
@@ -41,7 +41,7 @@ Preview::Preview(TQWidget* parent) : KDialogBase(parent), m_tiles(true)
m_changed = false;
setMainWidget(page);
- setFixedSize(sizeHint());
+ setFixedSize(tqsizeHint());
}
Preview::~Preview()
@@ -52,7 +52,7 @@ void Preview::selectionChanged(int which)
{
m_selectedFile = m_fileList[which];
drawPreview();
- m_drawFrame->repaint(0,0,-1,-1,false);
+ m_drawFrame->tqrepaint(0,0,-1,-1,false);
markChanged();
}
@@ -76,7 +76,7 @@ void Preview::initialise(const PreviewType type)
TQString extension;
TQString tile = Prefs::tileSet();
TQString back = Prefs::background();
- TQString layout = Prefs::layout();
+ TQString tqlayout = Prefs::layout();
// set up the concept of the current file. Initialised to the preferences
// value initially. Set the caption to indicate what we are doing
@@ -98,10 +98,10 @@ void Preview::initialise(const PreviewType type)
break;
case board:
- m_fileSelector = i18n("*.layout|Board Layout File (*.layout)\n");
+ m_fileSelector = i18n("*.tqlayout|Board Layout File (*.tqlayout)\n");
setCaption(i18n("Change Board Layout"));
- m_selectedFile = layout;
- extension = "*.layout";
+ m_selectedFile = tqlayout;
+ extension = "*.tqlayout";
break;
case theme:
@@ -158,16 +158,16 @@ void Preview::slotOk() {
}
void Preview::load() {
- KURL url = KFileDialog::getOpenURL(TQString::null, m_fileSelector, this, i18n("Open Board Layout" ));
+ KURL url = KFileDialog::getOpenURL(TQString(), m_fileSelector, this, i18n("Open Board Layout" ));
if ( !url.isEmpty() ) {
m_selectedFile = url.path();
drawPreview();
- m_drawFrame->repaint(0,0,-1,-1,false);
+ m_drawFrame->tqrepaint(0,0,-1,-1,false);
markChanged();
}
}
-// Top level preview drawing method. Background, tileset and layout
+// Top level preview drawing method. Background, tileset and tqlayout
// are initialised from the preferences. Depending on the type
// of preview dialog we pick up the selected file for one of these
// chaps.
@@ -176,7 +176,7 @@ void Preview::drawPreview()
{
TQString tile = Prefs::tileSet();
TQString back = Prefs::background();
- TQString layout = Prefs::layout();
+ TQString tqlayout = Prefs::layout();
switch (m_previewType)
{
@@ -189,15 +189,15 @@ void Preview::drawPreview()
break;
case board:
- layout = m_selectedFile;
+ tqlayout = m_selectedFile;
break;
case theme:
// a theme is quite a bit of work. We load the
- // specified bits in (layout, background and tileset
+ // specified bits in (tqlayout, background and tileset
if (!m_selectedFile.isEmpty())
{
- TQString backRaw, layoutRaw, tilesetRaw, magic;
+ TQString backRaw, tqlayoutRaw, tilesetRaw, magic;
TQFile in(m_selectedFile);
if (in.open(IO_ReadOnly))
@@ -212,38 +212,38 @@ void Preview::drawPreview()
}
tilesetRaw = stream.readLine();
backRaw = stream.readLine();
- layoutRaw = stream.readLine();
+ tqlayoutRaw = stream.readLine();
in.close();
tile = tilesetRaw;
- tile.replace(":", "/kmahjongg/pics/");
+ tile.tqreplace(":", "/kmahjongg/pics/");
if (!TQFile::exists(tile))
{
tile = tilesetRaw;
- tile = "pics/" + tile.right(tile.length() - tile.find(":") - 1 );
+ tile = "pics/" + tile.right(tile.length() - tile.tqfind(":") - 1 );
tile = locate("appdata", tile);
}
back = backRaw;
- back.replace(":", "/kmahjongg/pics/");
+ back.tqreplace(":", "/kmahjongg/pics/");
if (!TQFile::exists(back))
{
back = backRaw;
- back = "pics/" + back.right(back.length() - back.find(":") - 1);
+ back = "pics/" + back.right(back.length() - back.tqfind(":") - 1);
back = locate("appdata", back);
}
- layout = layoutRaw;
- layout.replace(":", "/kmahjongg/pics/");
- if (!TQFile::exists(layout))
+ tqlayout = tqlayoutRaw;
+ tqlayout.tqreplace(":", "/kmahjongg/pics/");
+ if (!TQFile::exists(tqlayout))
{
- layout = layoutRaw;
- layout = "pics/" + layout.right(layout.length() - layout.find(":") - 1);
- layout = locate("appdata", layout);
+ tqlayout = tqlayoutRaw;
+ tqlayout = "pics/" + tqlayout.right(tqlayout.length() - tqlayout.tqfind(":") - 1);
+ tqlayout = locate("appdata", tqlayout);
}
m_themeBack=back;
- m_themeLayout=layout;
+ m_themeLayout=tqlayout;
m_themeTileset=tile;
}
}
@@ -251,16 +251,16 @@ void Preview::drawPreview()
}
renderBackground(back);
- renderTiles(tile, layout);
+ renderTiles(tile, tqlayout);
}
void Preview::paintEvent( TQPaintEvent* ){
- m_drawFrame->repaint(false);
+ m_drawFrame->tqrepaint(false);
}
// the user selected ok, or apply. This method passes the changes
// across to the game widget and if necessary forces a board redraw
-// (unnecessary on layout changes since it only effects the next game)
+// (unnecessary on tqlayout changes since it only effects the next game)
void Preview::applyChange()
{
switch (m_previewType)
@@ -287,8 +287,8 @@ void Preview::applyChange()
break;
}
- // don't redraw for a layout change
- if (m_previewType == board || m_previewType == theme) layoutChange();
+ // don't redraw for a tqlayout change
+ if (m_previewType == board || m_previewType == theme) tqlayoutChange();
else boardRedraw(true);
// either way we mark the current value as unchanged
@@ -310,9 +310,9 @@ void Preview::renderBackground(const TQString &bg) {
// This method draws a mini-tiled board with no tiles missing.
-void Preview::renderTiles(const TQString &file, const TQString &layout) {
+void Preview::renderTiles(const TQString &file, const TQString &tqlayout) {
m_tiles.loadTileset(file, true);
- m_boardLayout.loadBoardLayout(layout);
+ m_boardLayout.loadBoardLayout(tqlayout);
TQPixmap *dest = m_drawFrame->getPreviewPixmap();
int xOffset = m_tiles.width()/2;
@@ -366,23 +366,23 @@ void Preview::renderTiles(const TQString &file, const TQString &layout) {
void Preview::saveTheme() {
TQString tile = Prefs::tileSet();
TQString back = Prefs::background();
- TQString layout = Prefs::layout();
+ TQString tqlayout = Prefs::layout();
TQString with = ":";
// we want to replace any path in the default store
// with a +
TQRegExp p(locate("data_dir", "/kmahjongg/pics/"));
- back.replace(p,with);
- tile.replace(p,with);
- layout.replace(p,with);
+ back.tqreplace(p,with);
+ tile.tqreplace(p,with);
+ tqlayout.tqreplace(p,with);
// Get the name of the file to save
KURL url = KFileDialog::getSaveURL(
NULL,
"*.theme",
- parentWidget(),
+ tqparentWidget(),
i18n("Save Theme" ));
if ( url.isEmpty() )
return;
@@ -402,7 +402,7 @@ void Preview::saveTheme() {
int res=KMessageBox::warningContinueCancel(this,
i18n("A file with that name "
"already exists. Do you "
- "wish to overwrite it?"),TQString::null,i18n("Overwrite"));
+ "wish to overwrite it?"),TQString(),i18n("Overwrite"));
if (res != KMessageBox::Continue)
return ;
}
@@ -417,12 +417,12 @@ void Preview::saveTheme() {
themeMagicV1_0,
tile.utf8().data(),
back.utf8().data(),
- layout.utf8().data());
+ tqlayout.utf8().data());
fclose(outFile);
}
-FrameImage::FrameImage (TQWidget *parent, const char *name)
- : TQFrame(parent, name)
+FrameImage::FrameImage (TQWidget *tqparent, const char *name)
+ : TQFrame(tqparent, name)
{
rx = -1;
thePixmap = new TQPixmap();
@@ -448,11 +448,11 @@ void FrameImage::paintEvent( TQPaintEvent* pa )
TQPen line;
- line.setStyle(DotLine);
+ line.setStyle(Qt::DotLine);
line.setWidth(2);
line.setColor(yellow);
p.setPen(line);
- p.setBackgroundMode(OpaqueMode);
+ p.setBackgroundMode(Qt::OpaqueMode);
p.setBackgroundColor(black);
int x = pa->rect().left();