[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [Patch] fix compile kdeui with msvc
From:       Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date:       2005-10-30 17:56:54
Message-ID: 43650966.6050505 () gmx ! de
[Download RAW message or body]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

And once more a patch for msvc support.

kcharselect.cpp
khelpmenu.cpp
klanguagebutton.cpp
knuminput.cpp
kruler.cpp
kruler.h
- - masked 'warning' directive

SConscript
- - added -DMAKE_KDEUI_LIB to ccflags

kactivelabel.cpp
- - struct -> class for private data structure

kconfigdialogmanager.h
- - KDECORE_EXPORT -> KDEUI_EXPORT (wrong macro used)

khbox.cpp
- - removed '#undef QT3_SUPPORT' to prevent compiler error in qwidget.h

kled.cpp
- - removed superflous "QColor Qt::black=Qt::black" (same for Qt::white)

kshortcutdialog.cpp
- - used QKeyEvent::modifiers() instead QKeyEvent::state() for conversion
to kde modifiers (QKeyEvent::modifiers() is new in Qt4)

ktabctl.h
- - use QVector instead of Q3MemArray according to Qt porting guide
(Q3MemArray throws compiler errors with msvc)

ktabctl.cpp
- - unsigned int -> int because QVector::size() returns int (avoid
compiler warnings)

And one small change for kdecore to use Qt::KeyboardModifiers instead of
Qt::KeyboardModifier for qtButtonStateToMod()

Christian
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDZQlmnNKwkgf+zVMRAgH7AJ4s7e9exxvHQXvL36Fsh+BNy2M9NACfXlMs
bD8CEG8lb6kdQfN9TqW4WP8=
=hCQV
-----END PGP SIGNATURE-----

["kdeui.patch" (text/x-diff)]

Index: kactivelabel.cpp
===================================================================
--- kactivelabel.cpp	(revision 475750)
+++ kactivelabel.cpp	(working copy)
@@ -26,8 +26,9 @@
 #include <QFocusEvent>
 #include <QWhatsThis>
 
-struct KActiveLabelPrivate
+class KActiveLabelPrivate
 {
+public:
     KActiveLabelPrivate(KActiveLabel *qq);
 
     void updatePalette();
Index: kcharselect.cpp
===================================================================
--- kcharselect.cpp	(revision 475750)
+++ kcharselect.cpp	(working copy)
@@ -104,7 +104,9 @@
     //const uint short chr=_chr;
     //if (chr)
     vChr = _chr;
+#ifdef __GNUC__
     #warning fixme //repaintContents( false );
+#endif
 }
 
 //==================================================================
@@ -123,7 +125,9 @@
     setSelectionMode(QAbstractItemView::SingleSelection);
     connect(selectionModel,SIGNAL(currentChanged ( const QModelIndex & ,const \
QModelIndex &)), this, SLOT(slotCurrentChanged ( const QModelIndex &, const \
QModelIndex &)));  delete m; // this should hopefully delete aold selection models \
too, since it is the parent of them (didn't track, if there are setParent calls \
somewhere. Check that (jowenn) +#ifdef __GNUC__
     #warning fixme //repaintContents( false );
+#endif
 }
 
 //==================================================================
@@ -172,7 +176,9 @@
     QTableView::resizeEvent(e);
 }
 
+#ifdef __GNUC__
 #warning fix all below
+#endif
 //==================================================================
 void KCharSelectTable::mouseMoveEvent( QMouseEvent *e )
 {
@@ -194,7 +200,9 @@
 	focusPos = vPos;
 	focusItem = vChr;
 
+#ifdef __GNUC__
 #warning fixme
+#endif
 /*	
 	repaintCell( oldFocus.y(), oldFocus.x(), true );
 	repaintCell( oldPos.y(), oldPos.x(), true );
@@ -299,7 +307,9 @@
 
     const QSize sz( 200,
                     200 );    
+#ifdef __GNUC__
     #warning fixme
+#endif
     #if 0    
     const QSize sz( charTable->contentsWidth()  +  4 ,
                     charTable->contentsHeight() +  4 );
@@ -307,7 +317,9 @@
     charTable->resize( sz );
     //charTable->setMaximumSize( sz );
     charTable->setMinimumSize( sz );
+#ifdef __GNUC__
     #warning fixme
+#endif
 /*    charTable->setHScrollBarMode( Q3ScrollView::AlwaysOff );
     charTable->setVScrollBarMode( Q3ScrollView::AlwaysOff );*/
 
Index: kconfigdialogmanager.h
===================================================================
--- kconfigdialogmanager.h	(revision 475750)
+++ kconfigdialogmanager.h	(working copy)
@@ -76,7 +76,7 @@
  * @author Benjamin C Meyer <ben+kdelibs at meyerhome dot net>
  * @author Waldo Bastian <bastian@kde.org>
  */
-class KDECORE_EXPORT KConfigDialogManager : public QObject {
+class KDEUI_EXPORT KConfigDialogManager : public QObject {
 
 Q_OBJECT
 
Index: khbox.cpp
===================================================================
--- khbox.cpp	(revision 475750)
+++ khbox.cpp	(working copy)
@@ -16,8 +16,6 @@
    Boston, MA 02111-1307, USA.
 */
 
-#undef QT3_SUPPORT
-
 #include "khbox.h"
 #include <qlayout.h>
 #include <qevent.h>
Index: khelpmenu.cpp
===================================================================
--- khelpmenu.cpp	(revision 475750)
+++ khelpmenu.cpp	(working copy)
@@ -128,7 +128,9 @@
 
     if( mShowWhatsThis && KAuthorized::authorizeKAction("help_whats_this") )
     {
+#ifdef __GNUC__
       #warning find a better way to get the default iconset, or reconsider using \
BarIconSet +#endif
       QToolButton* wtb = Q3WhatsThis::whatsThisButton(0);
       mMenu->addAction( wtb->icon(),i18n( "What's &This" ),this, \
SLOT(contextHelpActivated()), Qt::SHIFT + Qt::Key_F1);  delete wtb;
Index: klanguagebutton.cpp
===================================================================
--- klanguagebutton.cpp	(revision 475750)
+++ klanguagebutton.cpp	(working copy)
@@ -120,7 +120,9 @@
 
   QHBoxLayout *layout = new QHBoxLayout(this, 0, 0);
   layout->setAutoAdd(true);
+#ifdef __GNUC__
 #warning check if the name is used by some code using KLanguageButton
+#endif
   d->button = new QPushButton( this ); // HPB don't touch this!!
 
   clear();
Index: kled.cpp
===================================================================
--- kled.cpp	(revision 475750)
+++ kled.cpp	(working copy)
@@ -494,8 +494,6 @@
   QBrush darkBrush(d->offcolor);
   int w=width();
   int h=height();
-  QColor Qt::black=Qt::black;
-  QColor Qt::white=Qt::white;
   // -----
   if(raised)
     {
Index: knuminput.cpp
===================================================================
--- knuminput.cpp	(revision 475750)
+++ knuminput.cpp	(working copy)
@@ -293,7 +293,9 @@
     // the KIntValidator is broken beyond believe for
     // spinboxes which have suffix or prefix texts, so
     // better don't use it unless absolutely necessary
+#ifdef __GNUC__
 #warning KDE4 we NEED to fix the validation of values here
+#endif
 //	if (_base != 10)
 //        m_spin->setValidator(new KIntValidator(this, _base, \
"KNumInput::KIntValidtr"));  
@@ -1144,7 +1146,9 @@
   if ( !d->mValidator ) {
     d->mValidator =  new KDoubleSpinBoxValidator(this, minValue(), maxValue(), \
precision());  d->mValidator->setObjectName("d->mValidator" );
+#ifdef __GNUC__
 #warning KDE4 we NEED to fix the validation of values here
+#endif
 //    base::setValidator( d->mValidator );
   } else
     d->mValidator->setRange( minValue(), maxValue(), precision() );
Index: kruler.cpp
===================================================================
--- kruler.cpp	(revision 475750)
+++ kruler.cpp	(working copy)
@@ -135,7 +135,9 @@
 void KRuler::init(const char* name)
 {
   if (name) setObjectName(name);
+#ifdef __GNUC__
   #warning FIXME setFrameStyle(WinPanel | Raised);
+#endif
 
   tmDist = INIT_TINY_MARK_DISTANCE;
   lmDist = INIT_LITTLE_MARK_DISTANCE;
Index: kruler.h
===================================================================
--- kruler.h	(revision 475750)
+++ kruler.h	(working copy)
@@ -253,7 +253,9 @@
 
 
   void setFrameStyle(int) {
+#ifdef __GNUC__
 	#warning implement me (jowenn)
+#endif
   }
 
 
Index: kshortcutdialog.cpp
===================================================================
--- kshortcutdialog.cpp	(revision 475750)
+++ kshortcutdialog.cpp	(working copy)
@@ -401,7 +401,7 @@
 	int keyQt = QChar( e->key() & 0xff ).isLetter() ? 
 		(QChar( e->key() & 0xff ).toLower().latin1() | (e->key() & 0xffff00) )
 		: e->key();
-	int modQt = KKeyServer::qtButtonStateToMod( e->state() );
+	int modQt = KKeyServer::qtButtonStateToMod( e->modifiers() );
 	KKeyNative keyNative( KKey(keyQt, modQt) );
 	m_mod = keyNative.mod();
 	uint keySym = keyNative.sym();
@@ -463,7 +463,7 @@
 bool KShortcutDialog::event ( QEvent * e )
 {
 	if (e->type()==QEvent::KeyRelease) {
-		int modQt = KKeyServer::qtButtonStateToMod( static_cast<QKeyEvent*>(e)->state() );
+		int modQt = KKeyServer::qtButtonStateToMod( \
static_cast<QKeyEvent*>(e)->modifiers() );  KKeyNative keyNative( \
KKey(static_cast<QKeyEvent*>(e)->key(), modQt) );  uint keySym = keyNative.sym();
 
Index: ktabctl.cpp
===================================================================
--- ktabctl.cpp	(revision 475750)
+++ ktabctl.cpp	(working copy)
@@ -84,14 +84,12 @@
 
 void KTabCtl::show()
 {
-    unsigned int i;
-
     if(isVisible())
 	return;
 
     setSizes();
 
-    for(i = 0; i < pages.size(); i++)
+    for(int i = 0; i < pages.size(); i++)
 	pages[i]->hide();
 
     QResizeEvent r(size(), size());
@@ -102,9 +100,7 @@
 
 bool KTabCtl::isTabEnabled(const QString& name)
 {
-    unsigned int i;
-
-    for(i = 0; i < pages.size(); i++)
+    for(int i = 0; i < pages.size(); i++)
 	if (pages[i]->objectName() == name)
 	    return tabs->isTabEnabled(i);   /* return the enabled status */
     return false;     /* tab does not exist */
@@ -112,20 +108,16 @@
 
 void KTabCtl::setTabEnabled(const QString& name, bool state)
 {
-    unsigned i;
-
     if (name.isEmpty())
         return;
 
-    for (i = 0; i < pages.size(); i++)
+    for (int i = 0; i < pages.size(); i++)
 	if (pages[i]->objectName() == name)
 	    tabs->setTabEnabled(i, state);
 }
 
 void KTabCtl::setSizes()
 {
-    unsigned i;
-
     QSize min(tabs->sizeHint());    /* the minimum required size for the tabbar */
     tabs->resize(min);         /* make sure that the tabbar does not require more \
space than actually needed. */  
@@ -133,7 +125,7 @@
     QSize max(QCOORD_MAX,QCOORD_MAX);
     //int th = min.height();          /* the height of the tabbar itself (without \
pages and stuff) */  
-    for (i = 0; i < pages.size(); i++) {
+    for (int i = 0; i < pages.size(); i++) {
 
         /*
          * check the actual minimum and maximum sizes
@@ -198,7 +190,7 @@
 
 	/* overall desired size of all pages */
 	QSize pageHint;
-	for (unsigned int i = 0; i < pages.size(); i++)
+	for (int i = 0; i < pages.size(); i++)
 	{
 		QSize sizeI(pages[i]->sizeHint());
 
@@ -291,14 +283,13 @@
 
 void KTabCtl::showTab(int i)
 {
-    unsigned int j;
-    for (j = 0; j < pages.size(); j++) {
-      if (j != (unsigned)i) {
+    for (int j = 0; j < pages.size(); j++) {
+      if (j != i) {
         pages[j]->hide();
       }
     }
 
-    if((unsigned)i < pages.size()) {
+    if(i < pages.size()) {
         emit(tabSelected(i));
 		if( pages.size() >= 2 ) {
 			pages[i]->raise();
Index: ktabctl.h
===================================================================
--- ktabctl.h	(revision 475750)
+++ ktabctl.h	(working copy)
@@ -22,7 +22,7 @@
 
 #include <qwidget.h>
 #include <qtabbar.h>
-#include <q3memarray.h>
+#include <QVector>
 
 #include <kdelibs_export.h>
 
@@ -75,7 +75,7 @@
     QRect getChildRect() const;
 
     QTabBar * tabs;
-    Q3MemArray<QWidget *> pages;
+    QVector<QWidget*> pages;
     int bh;
     bool blBorder;
 protected:
Index: SConscript
===================================================================
--- SConscript	(revision 475750)
+++ SConscript	(working copy)
@@ -87,6 +87,7 @@
 obj.uselib   = 'QT QTCORE QTGUI QTXML QT3SUPPORT KDE4'
 obj.libpaths = '../kdecore/ ../kdefx/ ../dcop'
 obj.libs     = 'kdecore kdefx DCOP'
+obj.ccflags += ' -DMAKE_KDEUI_LIB '
 if env['WINDOWS']:
 	obj.libpaths += ' ../win'
 	obj.libs     += ' kdewin32'


["kdecore.patch" (text/x-diff)]

Index: kkeyserver_x11.cpp
===================================================================
--- kkeyserver_x11.cpp	(revision 475750)
+++ kkeyserver_x11.cpp	(working copy)
@@ -690,7 +690,7 @@
 	return modToModQt( modX, modQt );
 }
 
-KDECORE_EXPORT int qtButtonStateToMod( Qt::KeyboardModifier s )
+KDECORE_EXPORT int qtButtonStateToMod( Qt::KeyboardModifiers s )
 {
 	int modQt = 0;
 	if (s & Qt::ShiftModifier) modQt |= KKey::SHIFT;
Index: kkeyserver_x11.h
===================================================================
--- kkeyserver_x11.h	(revision 475750)
+++ kkeyserver_x11.h	(working copy)
@@ -419,7 +419,7 @@
 	 * Converts the Qt-compatible button state to KKey modifier.
          * Windows only.
 	 */
-	KDECORE_EXPORT int qtButtonStateToMod( Qt::KeyboardModifier s );
+	KDECORE_EXPORT int qtButtonStateToMod( Qt::KeyboardModifiers s );
 #endif
 
 	/**


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic