Code maintenance for Qt 5:

- Fixed some missing headers
- Fixed some deprecated functions

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6845 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-10-19 02:07:01 +00:00
parent 30103ef5f2
commit 3e15a7bb86
15 changed files with 136 additions and 147 deletions

View file

@ -47,9 +47,6 @@
class QModelIndex; class QModelIndex;
class QPainter; class QPainter;
class QStyleOptionProgressBarV2;
class QProgressBar;
class QApplication;
class DLListDelegate: public QAbstractItemDelegate { class DLListDelegate: public QAbstractItemDelegate {

View file

@ -41,9 +41,6 @@
class QModelIndex; class QModelIndex;
class QPainter; class QPainter;
class QStyleOptionProgressBarV2;
class QProgressBar;
class QApplication;
class ULListDelegate: public QAbstractItemDelegate { class ULListDelegate: public QAbstractItemDelegate {

View file

@ -24,8 +24,7 @@
#include <util/RetroStyleLabel.h> #include <util/RetroStyleLabel.h>
#include <util/MouseEventFilter.h> #include <util/MouseEventFilter.h>
#include <QGridLayout>
#include <QtGui>
LogoBar::LogoBar(QWidget * parent) LogoBar::LogoBar(QWidget * parent)
: QFrame(parent) { : QFrame(parent) {

View file

@ -28,17 +28,10 @@
#define FNAME 0 #define FNAME 0
#define FSIZE 1 #define FSIZE 1
#define MAX_CHAR_TMP 128 #define MAX_CHAR_TMP 128
class QModelIndex; class QModelIndex;
class QPainter; class QPainter;
class QStyleOptionProgressBarV2;
class QProgressBar;
class QApplication;
class SFListDelegate: public QAbstractItemDelegate { class SFListDelegate: public QAbstractItemDelegate {
@ -57,4 +50,3 @@ class SFListDelegate: public QAbstractItemDelegate {
signals: signals:
}; };
#endif #endif

View file

@ -361,28 +361,28 @@ QString ExprParamElement::toString()
} else } else
{ {
if (searchType == DateSearch) { if (searchType == DateSearch) {
QDateEdit * dateEdit = qFindChild<QDateEdit *> (internalframe, "param1"); QDateEdit * dateEdit = internalframe->findChild<QDateEdit *> ("param1");
str = dateEdit->text(); str = dateEdit->text();
if (inRangedConfig) if (inRangedConfig)
{ {
str += QString(" ") + tr("to") + QString(" "); str += QString(" ") + tr("to") + QString(" ");
dateEdit = qFindChild<QDateEdit *> (internalframe, "param2"); dateEdit = internalframe->findChild<QDateEdit *> ("param2");
str += dateEdit->text(); str += dateEdit->text();
} }
} else if (searchType == SizeSearch) } else if (searchType == SizeSearch)
{ {
QLineEdit * lineEditSize = qFindChild<QLineEdit*>(internalframe, "param1"); QLineEdit * lineEditSize = internalframe->findChild<QLineEdit*>("param1");
str = ("" == lineEditSize->text()) ? "0" str = ("" == lineEditSize->text()) ? "0"
: lineEditSize->text(); : lineEditSize->text();
QComboBox * cb = qFindChild<QComboBox*> (internalframe, "unitsCb1"); QComboBox * cb = internalframe->findChild<QComboBox*> ("unitsCb1");
str += QString(" ") + cb->itemText(cb->currentIndex()); str += QString(" ") + cb->itemText(cb->currentIndex());
if (inRangedConfig) if (inRangedConfig)
{ {
str += QString(" ") + tr("to") + QString(" "); str += QString(" ") + tr("to") + QString(" ");
lineEditSize = qFindChild<QLineEdit*>(internalframe, "param2"); lineEditSize = internalframe->findChild<QLineEdit*>("param2");
str += ("" == lineEditSize->text()) ? "0" str += ("" == lineEditSize->text()) ? "0"
: lineEditSize->text(); : lineEditSize->text();
cb = qFindChild<QComboBox*> (internalframe, "unitsCb2"); cb = internalframe->findChild<QComboBox*> ("unitsCb2");
str += QString(" ") + cb->itemText(cb->currentIndex()); str += QString(" ") + cb->itemText(cb->currentIndex());
} }
} }
@ -401,7 +401,7 @@ void ExprParamElement::adjustForSearchType(ExprSearchType type)
hexValidator = new QRegExpValidator(hexRegExp, this); hexValidator = new QRegExpValidator(hexRegExp, this);
// remove all elements // remove all elements
QList<QWidget*> children = qFindChildren<QWidget*>(internalframe); QList<QWidget*> children = internalframe->findChildren<QWidget*>();
QWidget* child; QWidget* child;
QLayout * lay_out = internalframe->layout(); QLayout * lay_out = internalframe->layout();
while (!children.isEmpty()) while (!children.isEmpty())
@ -555,7 +555,7 @@ void ExprParamElement::setRangedSearch(bool ranged)
bool ExprParamElement::ignoreCase() bool ExprParamElement::ignoreCase()
{ {
return (isStringSearchExpression() return (isStringSearchExpression()
&& (qFindChild<QCheckBox*>(internalframe, "ignoreCaseCB")) && (internalframe->findChild<QCheckBox*>("ignoreCaseCB"))
->checkState()==Qt::Checked); ->checkState()==Qt::Checked);
} }
@ -563,7 +563,7 @@ QString ExprParamElement::getStrSearchValue()
{ {
if (!isStringSearchExpression()) return ""; if (!isStringSearchExpression()) return "";
QLineEdit * lineEdit = qFindChild<QLineEdit*>(internalframe, "param1"); QLineEdit * lineEdit = internalframe->findChild<QLineEdit*>("param1");
return lineEdit->displayText(); return lineEdit->displayText();
} }
@ -579,19 +579,19 @@ uint64_t ExprParamElement::getIntValueFromField(QString fieldName, bool isToFiel
{ {
case DateSearch: case DateSearch:
{ {
QDateEdit * dateEdit = qFindChild<QDateEdit *> (internalframe, (fieldName + suffix)); QDateEdit * dateEdit = internalframe->findChild<QDateEdit *> (fieldName + suffix);
QDateTime * time = new QDateTime(dateEdit->date()); QDateTime * time = new QDateTime(dateEdit->date());
val = (uint64_t)time->toTime_t(); val = (uint64_t)time->toTime_t();
break; break;
} }
case SizeSearch: case SizeSearch:
{ {
QLineEdit * lineEditSize = qFindChild<QLineEdit*>(internalframe, (fieldName + suffix)); QLineEdit * lineEditSize = internalframe->findChild<QLineEdit*>(fieldName + suffix);
bool ok2 = false; bool ok2 = false;
val = (lineEditSize->displayText()).toULongLong(&ok2); val = (lineEditSize->displayText()).toULongLong(&ok2);
if (ok2) if (ok2)
{ {
QComboBox * cb = qFindChild<QComboBox*> (internalframe, (QString("unitsCb") + suffix)); QComboBox * cb = internalframe->findChild<QComboBox*>((QString("unitsCb") + suffix));
QVariant data = cb->itemData(cb->currentIndex()); QVariant data = cb->itemData(cb->currentIndex());
val *= data.toULongLong(); val *= data.toULongLong();
} }

View file

@ -43,8 +43,6 @@ CreateChannel::CreateChannel()
ui.headerFrame->setHeaderImage(QPixmap(":/images/add_channel64.png")); ui.headerFrame->setHeaderImage(QPixmap(":/images/add_channel64.png"));
ui.headerFrame->setHeaderText(tr("New Channel")); ui.headerFrame->setHeaderText(tr("New Channel"));
picture = NULL;
// connect up the buttons. // connect up the buttons.
connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createChannel())); connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createChannel()));
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close())); connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));

View file

@ -26,6 +26,7 @@
#include <QBuffer> #include <QBuffer>
#include <QMenu> #include <QMenu>
#include <QDir> #include <QDir>
#include <QMimeData>
#include <gui/RetroShareLink.h> #include <gui/RetroShareLink.h>
#include "CreateChannelMsg.h" #include "CreateChannelMsg.h"

View file

@ -23,6 +23,7 @@
#include <QDropEvent> #include <QDropEvent>
#include <QUrl> #include <QUrl>
#include <QFileInfo> #include <QFileInfo>
#include <QMimeData>
#include "DropLineEdit.h" #include "DropLineEdit.h"

View file

@ -25,6 +25,7 @@
#include <QDropEvent> #include <QDropEvent>
#include <QUrl> #include <QUrl>
#include <QTimer> #include <QTimer>
#include <QMimeData>
#include <iostream> #include <iostream>

View file

@ -409,7 +409,7 @@ void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight()); QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
gradient.setColorAt(0, Qt::white); gradient.setColorAt(0, Qt::white);
gradient.setColorAt(1, Qt::lightGray); gradient.setColorAt(1, Qt::lightGray);
painter->fillRect(rect.intersect(sceneRect), gradient); painter->fillRect(rect.intersected(sceneRect), gradient);
painter->setBrush(Qt::NoBrush); painter->setBrush(Qt::NoBrush);
painter->drawRect(sceneRect); painter->drawRect(sceneRect);

View file

@ -32,8 +32,8 @@ IMHistoryItemDelegate::IMHistoryItemDelegate(QWidget *parent)
void IMHistoryItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const void IMHistoryItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
if (qVariantCanConvert<IMHistoryItemPainter>(index.data())) { if (index.data().canConvert<IMHistoryItemPainter>()) {
IMHistoryItemPainter itemPainter = qVariantValue<IMHistoryItemPainter>(index.data()); IMHistoryItemPainter itemPainter = index.data().value<IMHistoryItemPainter>();
itemPainter.paint(painter, option, IMHistoryItemPainter::ReadOnly); itemPainter.paint(painter, option, IMHistoryItemPainter::ReadOnly);
} else { } else {
QItemDelegate::paint(painter, option, index); QItemDelegate::paint(painter, option, index);
@ -42,8 +42,8 @@ void IMHistoryItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
QSize IMHistoryItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const QSize IMHistoryItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
if (qVariantCanConvert<IMHistoryItemPainter>(index.data())) { if (index.data().canConvert<IMHistoryItemPainter>()) {
IMHistoryItemPainter painter = qVariantValue<IMHistoryItemPainter>(index.data()); IMHistoryItemPainter painter = index.data().value<IMHistoryItemPainter>();
return painter.sizeHint(); return painter.sizeHint();
} else { } else {
return QItemDelegate::sizeHint(option, index); return QItemDelegate::sizeHint(option, index);

View file

@ -281,7 +281,7 @@ ChatPage::save(QString &/*errmsg*/)
ChatStyleInfo info; ChatStyleInfo info;
QListWidgetItem *item = ui.publicList->currentItem(); QListWidgetItem *item = ui.publicList->currentItem();
if (item) { if (item) {
info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole)); info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) { if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) {
Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText()); Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PUBLIC); NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PUBLIC);
@ -290,7 +290,7 @@ ChatPage::save(QString &/*errmsg*/)
item = ui.privateList->currentItem(); item = ui.privateList->currentItem();
if (item) { if (item) {
info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole)); info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) { if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) {
Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText()); Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PRIVATE); NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PRIVATE);
@ -299,7 +299,7 @@ ChatPage::save(QString &/*errmsg*/)
item = ui.historyList->currentItem(); item = ui.historyList->currentItem();
if (item) { if (item) {
info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole)); info = item->data(Qt::UserRole).value<ChatStyleInfo>();
if (historyStylePath != info.stylePath || historyStyleVariant != ui.historyComboBoxVariant->currentText()) { if (historyStylePath != info.stylePath || historyStyleVariant != ui.historyComboBoxVariant->currentText()) {
Settings->setHistoryChatStyle(info.stylePath, ui.historyComboBoxVariant->currentText()); Settings->setHistoryChatStyle(info.stylePath, ui.historyComboBoxVariant->currentText());
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_HISTORY); NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_HISTORY);
@ -476,7 +476,7 @@ void ChatPage::fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBr
{ {
QListWidgetItem *item = listWidget->currentItem(); QListWidgetItem *item = listWidget->currentItem();
if (item) { if (item) {
ChatStyleInfo info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole)); ChatStyleInfo info = item->data(Qt::UserRole).value<ChatStyleInfo>();
setPreviewMessages(info.stylePath, comboBox->currentText(), textBrowser); setPreviewMessages(info.stylePath, comboBox->currentText(), textBrowser);
} else { } else {
@ -488,7 +488,7 @@ void ChatPage::on_publicList_currentRowChanged(int currentRow)
{ {
if (currentRow != -1) { if (currentRow != -1) {
QListWidgetItem *item = ui.publicList->item(currentRow); QListWidgetItem *item = ui.publicList->item(currentRow);
ChatStyleInfo info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole)); ChatStyleInfo info = item->data(Qt::UserRole).value<ChatStyleInfo>();
QString author = info.authorName; QString author = info.authorName;
if (info.authorEmail.isEmpty() == false) { if (info.authorEmail.isEmpty() == false) {
@ -524,7 +524,7 @@ void ChatPage::on_privateList_currentRowChanged(int currentRow)
{ {
if (currentRow != -1) { if (currentRow != -1) {
QListWidgetItem *item = ui.privateList->item(currentRow); QListWidgetItem *item = ui.privateList->item(currentRow);
ChatStyleInfo info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole)); ChatStyleInfo info = item->data(Qt::UserRole).value<ChatStyleInfo>();
QString author = info.authorName; QString author = info.authorName;
if (info.authorEmail.isEmpty() == false) { if (info.authorEmail.isEmpty() == false) {
@ -560,7 +560,7 @@ void ChatPage::on_historyList_currentRowChanged(int currentRow)
{ {
if (currentRow != -1) { if (currentRow != -1) {
QListWidgetItem *item = ui.historyList->item(currentRow); QListWidgetItem *item = ui.historyList->item(currentRow);
ChatStyleInfo info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole)); ChatStyleInfo info = item->data(Qt::UserRole).value<ChatStyleInfo>();
QString author = info.authorName; QString author = info.authorName;
if (info.authorEmail.isEmpty() == false) { if (info.authorEmail.isEmpty() == false) {

View file

@ -764,7 +764,7 @@ bool RsHtml::makeEmbeddedImage(const QImage &originalImage, QString &embeddedIma
// ask user // ask user
QMessageBox msgBox; QMessageBox msgBox;
msgBox.setText(QString(QApplication::translate("RsHtml", "Image is oversized for transmission.\nReducing image to %1x%2 pixels?", 0, QApplication::UnicodeUTF8)).arg(newSize.width()).arg(newSize.height())); msgBox.setText(QString(QApplication::translate("RsHtml", "Image is oversized for transmission.\nReducing image to %1x%2 pixels?")).arg(newSize.width()).arg(newSize.height()));
msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel); msgBox.setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Ok); msgBox.setDefaultButton(QMessageBox::Ok);
if (msgBox.exec() != QMessageBox::Ok) { if (msgBox.exec() != QMessageBox::Ok) {

View file

@ -21,7 +21,8 @@
#include <util/RetroStyleLabel.h> #include <util/RetroStyleLabel.h>
#include <QtGui> #include <QPainter>
#include <QMouseEvent>
RetroStyleLabel::RetroStyleLabel(QWidget * parent, Mode mode, Qt::AlignmentFlag hAlign) RetroStyleLabel::RetroStyleLabel(QWidget * parent, Mode mode, Qt::AlignmentFlag hAlign)
: QLabel(parent), _mode(mode) { : QLabel(parent), _mode(mode) {

View file

@ -21,7 +21,9 @@
#include <util/Widget.h> #include <util/Widget.h>
#include <QtGui> #include <QDialog>
#include <QWidget>
#include <QGridLayout>
QGridLayout * Widget::createLayout(QWidget * parent) { QGridLayout * Widget::createLayout(QWidget * parent) {
QGridLayout * layout = new QGridLayout(parent); QGridLayout * layout = new QGridLayout(parent);