Changed QVariant::fromValue() to qVariantFromValue, since MSVC6 supposedly cannot...
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 19 Jan 2008 16:03:43 +0000 (16:03 +0000)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sat, 19 Jan 2008 16:03:43 +0000 (16:03 +0000)
with member templates. Well, we need to change all the value<> stuff too, probably, but I'll
wait until we actually try and compile on windows again (and get failures doing so), since we
didn't seem to have problems earlier with it.

src/client/buffermodel.cpp
src/client/networkmodel.cpp
src/core/coresession.cpp
src/core/coreusersettings.cpp

index ad4c51a..80b16a3 100644 (file)
@@ -75,7 +75,8 @@ void BufferModel::mapProperty(int column, int role, QObject *target, const QByte
 void BufferModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) {
   Q_UNUSED(command)
   BufferId newCurrentBuffer;
 void BufferModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) {
   Q_UNUSED(command)
   BufferId newCurrentBuffer;
-  if(index.data(NetworkModel::ItemTypeRole) == NetworkModel::BufferItemType && currentBuffer != (newCurrentBuffer = index.data(NetworkModel::BufferIdRole).value<BufferId>())) {
+  if(index.data(NetworkModel::ItemTypeRole) == NetworkModel::BufferItemType
+     && currentBuffer != (newCurrentBuffer = qVariantValue<BufferId>(index.data(NetworkModel::BufferIdRole)))) {
     currentBuffer = newCurrentBuffer;
     // FIXME: to something like: index.setData(ActivitRole, NoActivity);
     // networkModel->bufferActivity(BufferItem::NoActivity, currentBuffer);
     currentBuffer = newCurrentBuffer;
     // FIXME: to something like: index.setData(ActivitRole, NoActivity);
     // networkModel->bufferActivity(BufferItem::NoActivity, currentBuffer);
index aa4aefe..6d6792c 100644 (file)
@@ -94,9 +94,9 @@ QVariant BufferItem::data(int column, int role) const {
   case NetworkModel::ItemTypeRole:
     return NetworkModel::BufferItemType;
   case NetworkModel::BufferIdRole:
   case NetworkModel::ItemTypeRole:
     return NetworkModel::BufferItemType;
   case NetworkModel::BufferIdRole:
-    return QVariant::fromValue<BufferId>(bufferInfo().uid());
+    return qVariantFromValue(bufferInfo().uid());
   case NetworkModel::NetworkIdRole:
   case NetworkModel::NetworkIdRole:
-    return QVariant::fromValue<NetworkId>(bufferInfo().networkId());
+    return qVariantFromValue(bufferInfo().networkId());
   case NetworkModel::BufferTypeRole:
     return int(bufferType());
   case NetworkModel::ItemActiveRole:
   case NetworkModel::BufferTypeRole:
     return int(bufferType());
   case NetworkModel::ItemActiveRole:
@@ -220,7 +220,7 @@ NetworkItem::NetworkItem(const NetworkId &netid, AbstractTreeItem *parent)
 QVariant NetworkItem::data(int column, int role) const {
   switch(role) {
   case NetworkModel::NetworkIdRole:
 QVariant NetworkItem::data(int column, int role) const {
   switch(role) {
   case NetworkModel::NetworkIdRole:
-    return QVariant::fromValue<NetworkId>(_networkId);
+    return qVariantFromValue(_networkId);
   case NetworkModel::ItemTypeRole:
     return NetworkModel::NetworkItemType;
   case NetworkModel::ItemActiveRole:
   case NetworkModel::ItemTypeRole:
     return NetworkModel::NetworkItemType;
   case NetworkModel::ItemActiveRole:
index 6b28d71..c34e898 100644 (file)
@@ -310,10 +310,10 @@ QVariant CoreSession::sessionState() {
   QVariantMap v;
 
   QVariantList bufs;
   QVariantMap v;
 
   QVariantList bufs;
-  foreach(BufferInfo id, buffers()) bufs << QVariant::fromValue(id);
+  foreach(BufferInfo id, buffers()) bufs << qVariantFromValue(id);
   v["BufferInfos"] = bufs;
   QVariantList networkids;
   v["BufferInfos"] = bufs;
   QVariantList networkids;
-  foreach(NetworkId id, _networks.keys()) networkids << QVariant::fromValue(id);
+  foreach(NetworkId id, _networks.keys()) networkids << qVariantFromValue(id);
   v["NetworkIds"] = networkids;
 
   quint32 ircusercount = 0;
   v["NetworkIds"] = networkids;
 
   quint32 ircusercount = 0;
@@ -326,7 +326,7 @@ QVariant CoreSession::sessionState() {
   v["IrcChannelCount"] = ircchannelcount;
 
   QList<QVariant> idlist;
   v["IrcChannelCount"] = ircchannelcount;
 
   QList<QVariant> idlist;
-  foreach(Identity *i, _identities.values()) idlist << QVariant::fromValue<Identity>(*i);
+  foreach(Identity *i, _identities.values()) idlist << qVariantFromValue(*i);
   v["Identities"] = idlist;
 
   v["SessionData"] = sessionData;
   v["Identities"] = idlist;
 
   v["SessionData"] = sessionData;
@@ -347,7 +347,7 @@ void CoreSession::sendBacklog(BufferInfo id, QVariant v1, QVariant v2) {
 
   // Send messages out in smaller packages - we don't want to make the signal data too large!
   for(int i = 0; i < msglist.count(); i++) {
 
   // Send messages out in smaller packages - we don't want to make the signal data too large!
   for(int i = 0; i < msglist.count(); i++) {
-    log.append(QVariant::fromValue(msglist[i]));
+    log.append(qVariantFromValue(msglist[i]));
     if(log.count() >= 5) {
       emit backlogData(id, log, i >= msglist.count() - 1);
       log.clear();
     if(log.count() >= 5) {
       emit backlogData(id, log, i >= msglist.count() - 1);
       log.clear();
index bf1a675..a858d57 100644 (file)
@@ -26,7 +26,7 @@ CoreUserSettings::CoreUserSettings(UserId uid) : CoreSettings(QString("CoreUser/
 }
 
 void CoreUserSettings::storeIdentity(const Identity &identity) {
 }
 
 void CoreUserSettings::storeIdentity(const Identity &identity) {
-  setLocalValue(QString("Identities/%1").arg(identity.id().toInt()), QVariant::fromValue<Identity>(identity));
+  setLocalValue(QString("Identities/%1").arg(identity.id().toInt()), qVariantFromValue(identity));
 }
 
 void CoreUserSettings::removeIdentity(const Identity &identity) {
 }
 
 void CoreUserSettings::removeIdentity(const Identity &identity) {