mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-25 01:10:19 -05:00
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:
parent
30103ef5f2
commit
3e15a7bb86
@ -47,9 +47,6 @@
|
||||
|
||||
class QModelIndex;
|
||||
class QPainter;
|
||||
class QStyleOptionProgressBarV2;
|
||||
class QProgressBar;
|
||||
class QApplication;
|
||||
|
||||
|
||||
class DLListDelegate: public QAbstractItemDelegate {
|
||||
|
@ -41,9 +41,6 @@
|
||||
|
||||
class QModelIndex;
|
||||
class QPainter;
|
||||
class QStyleOptionProgressBarV2;
|
||||
class QProgressBar;
|
||||
class QApplication;
|
||||
|
||||
|
||||
class ULListDelegate: public QAbstractItemDelegate {
|
||||
|
@ -17,89 +17,88 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include "LogoBar.h"
|
||||
|
||||
#include <util/RetroStyleLabel.h>
|
||||
#include <util/MouseEventFilter.h>
|
||||
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
LogoBar::LogoBar(QWidget * parent)
|
||||
: QFrame(parent) {
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
LogoBar::~LogoBar() {
|
||||
}
|
||||
|
||||
void LogoBar::init() {
|
||||
setFrameShape(QFrame::NoFrame);
|
||||
|
||||
|
||||
|
||||
//LogoButton
|
||||
_logoButton = new RetroStyleLabel(this);
|
||||
_logoButton->setPixmaps(
|
||||
QPixmap(":/images/logobar/rslogo2.png"), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(), //Fill
|
||||
|
||||
QPixmap(":/images/logobar/rslogo2.png"), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap() //Fill
|
||||
);
|
||||
_logoButton->setMaximumSize(QSize(110, 65));
|
||||
_logoButton->setMinimumSize(QSize(110, 65));
|
||||
connect(_logoButton, SIGNAL(clicked()), SLOT(logoButtonClickedSlot()));
|
||||
|
||||
//FillLabel1
|
||||
RetroStyleLabel * FillLabel1 = new RetroStyleLabel(this);
|
||||
FillLabel1->setPixmaps(
|
||||
QPixmap(), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(":/images/logobar/logo_bar_fill.png"), //Fill
|
||||
|
||||
QPixmap(), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(":/images/logobar/logo_bar_fill.png") //Fill
|
||||
);
|
||||
|
||||
//FillLabel2
|
||||
RetroStyleLabel * FillLabel2 = new RetroStyleLabel(this);
|
||||
FillLabel2->setPixmaps(
|
||||
QPixmap(), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(":/images/logobar/logo_bar_fill.png"), //Fill
|
||||
|
||||
QPixmap(), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(":/images/logobar/logo_bar_fill.png") //Fill
|
||||
);
|
||||
|
||||
QGridLayout * layout = new QGridLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
layout->addWidget(FillLabel1, 0, 0);
|
||||
layout->addWidget(_logoButton, 0, 1);
|
||||
layout->addWidget(FillLabel2, 0, 2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LogoBar::setEnabledLogoButton(bool enable) {
|
||||
_logoButton->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
void LogoBar::logoButtonClickedSlot() {
|
||||
logoButtonClicked();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
****************************************************************/
|
||||
|
||||
#include "LogoBar.h"
|
||||
|
||||
#include <util/RetroStyleLabel.h>
|
||||
#include <util/MouseEventFilter.h>
|
||||
|
||||
#include <QGridLayout>
|
||||
|
||||
LogoBar::LogoBar(QWidget * parent)
|
||||
: QFrame(parent) {
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
LogoBar::~LogoBar() {
|
||||
}
|
||||
|
||||
void LogoBar::init() {
|
||||
setFrameShape(QFrame::NoFrame);
|
||||
|
||||
|
||||
|
||||
//LogoButton
|
||||
_logoButton = new RetroStyleLabel(this);
|
||||
_logoButton->setPixmaps(
|
||||
QPixmap(":/images/logobar/rslogo2.png"), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(), //Fill
|
||||
|
||||
QPixmap(":/images/logobar/rslogo2.png"), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap() //Fill
|
||||
);
|
||||
_logoButton->setMaximumSize(QSize(110, 65));
|
||||
_logoButton->setMinimumSize(QSize(110, 65));
|
||||
connect(_logoButton, SIGNAL(clicked()), SLOT(logoButtonClickedSlot()));
|
||||
|
||||
//FillLabel1
|
||||
RetroStyleLabel * FillLabel1 = new RetroStyleLabel(this);
|
||||
FillLabel1->setPixmaps(
|
||||
QPixmap(), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(":/images/logobar/logo_bar_fill.png"), //Fill
|
||||
|
||||
QPixmap(), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(":/images/logobar/logo_bar_fill.png") //Fill
|
||||
);
|
||||
|
||||
//FillLabel2
|
||||
RetroStyleLabel * FillLabel2 = new RetroStyleLabel(this);
|
||||
FillLabel2->setPixmaps(
|
||||
QPixmap(), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(":/images/logobar/logo_bar_fill.png"), //Fill
|
||||
|
||||
QPixmap(), //Start
|
||||
QPixmap(), //End
|
||||
QPixmap(":/images/logobar/logo_bar_fill.png") //Fill
|
||||
);
|
||||
|
||||
QGridLayout * layout = new QGridLayout(this);
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
||||
layout->addWidget(FillLabel1, 0, 0);
|
||||
layout->addWidget(_logoButton, 0, 1);
|
||||
layout->addWidget(FillLabel2, 0, 2);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LogoBar::setEnabledLogoButton(bool enable) {
|
||||
_logoButton->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
void LogoBar::logoButtonClickedSlot() {
|
||||
logoButtonClicked();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -28,17 +28,10 @@
|
||||
#define FNAME 0
|
||||
#define FSIZE 1
|
||||
|
||||
|
||||
|
||||
|
||||
#define MAX_CHAR_TMP 128
|
||||
|
||||
class QModelIndex;
|
||||
class QPainter;
|
||||
class QStyleOptionProgressBarV2;
|
||||
class QProgressBar;
|
||||
class QApplication;
|
||||
|
||||
|
||||
class SFListDelegate: public QAbstractItemDelegate {
|
||||
|
||||
@ -57,4 +50,3 @@ class SFListDelegate: public QAbstractItemDelegate {
|
||||
signals:
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -361,28 +361,28 @@ QString ExprParamElement::toString()
|
||||
} else
|
||||
{
|
||||
if (searchType == DateSearch) {
|
||||
QDateEdit * dateEdit = qFindChild<QDateEdit *> (internalframe, "param1");
|
||||
QDateEdit * dateEdit = internalframe->findChild<QDateEdit *> ("param1");
|
||||
str = dateEdit->text();
|
||||
if (inRangedConfig)
|
||||
{
|
||||
str += QString(" ") + tr("to") + QString(" ");
|
||||
dateEdit = qFindChild<QDateEdit *> (internalframe, "param2");
|
||||
dateEdit = internalframe->findChild<QDateEdit *> ("param2");
|
||||
str += dateEdit->text();
|
||||
}
|
||||
} else if (searchType == SizeSearch)
|
||||
{
|
||||
QLineEdit * lineEditSize = qFindChild<QLineEdit*>(internalframe, "param1");
|
||||
QLineEdit * lineEditSize = internalframe->findChild<QLineEdit*>("param1");
|
||||
str = ("" == lineEditSize->text()) ? "0"
|
||||
: lineEditSize->text();
|
||||
QComboBox * cb = qFindChild<QComboBox*> (internalframe, "unitsCb1");
|
||||
QComboBox * cb = internalframe->findChild<QComboBox*> ("unitsCb1");
|
||||
str += QString(" ") + cb->itemText(cb->currentIndex());
|
||||
if (inRangedConfig)
|
||||
{
|
||||
str += QString(" ") + tr("to") + QString(" ");
|
||||
lineEditSize = qFindChild<QLineEdit*>(internalframe, "param2");
|
||||
lineEditSize = internalframe->findChild<QLineEdit*>("param2");
|
||||
str += ("" == lineEditSize->text()) ? "0"
|
||||
: lineEditSize->text();
|
||||
cb = qFindChild<QComboBox*> (internalframe, "unitsCb2");
|
||||
cb = internalframe->findChild<QComboBox*> ("unitsCb2");
|
||||
str += QString(" ") + cb->itemText(cb->currentIndex());
|
||||
}
|
||||
}
|
||||
@ -401,7 +401,7 @@ void ExprParamElement::adjustForSearchType(ExprSearchType type)
|
||||
hexValidator = new QRegExpValidator(hexRegExp, this);
|
||||
|
||||
// remove all elements
|
||||
QList<QWidget*> children = qFindChildren<QWidget*>(internalframe);
|
||||
QList<QWidget*> children = internalframe->findChildren<QWidget*>();
|
||||
QWidget* child;
|
||||
QLayout * lay_out = internalframe->layout();
|
||||
while (!children.isEmpty())
|
||||
@ -555,7 +555,7 @@ void ExprParamElement::setRangedSearch(bool ranged)
|
||||
bool ExprParamElement::ignoreCase()
|
||||
{
|
||||
return (isStringSearchExpression()
|
||||
&& (qFindChild<QCheckBox*>(internalframe, "ignoreCaseCB"))
|
||||
&& (internalframe->findChild<QCheckBox*>("ignoreCaseCB"))
|
||||
->checkState()==Qt::Checked);
|
||||
}
|
||||
|
||||
@ -563,7 +563,7 @@ QString ExprParamElement::getStrSearchValue()
|
||||
{
|
||||
if (!isStringSearchExpression()) return "";
|
||||
|
||||
QLineEdit * lineEdit = qFindChild<QLineEdit*>(internalframe, "param1");
|
||||
QLineEdit * lineEdit = internalframe->findChild<QLineEdit*>("param1");
|
||||
return lineEdit->displayText();
|
||||
}
|
||||
|
||||
@ -579,19 +579,19 @@ uint64_t ExprParamElement::getIntValueFromField(QString fieldName, bool isToFiel
|
||||
{
|
||||
case DateSearch:
|
||||
{
|
||||
QDateEdit * dateEdit = qFindChild<QDateEdit *> (internalframe, (fieldName + suffix));
|
||||
QDateEdit * dateEdit = internalframe->findChild<QDateEdit *> (fieldName + suffix);
|
||||
QDateTime * time = new QDateTime(dateEdit->date());
|
||||
val = (uint64_t)time->toTime_t();
|
||||
break;
|
||||
}
|
||||
case SizeSearch:
|
||||
{
|
||||
QLineEdit * lineEditSize = qFindChild<QLineEdit*>(internalframe, (fieldName + suffix));
|
||||
QLineEdit * lineEditSize = internalframe->findChild<QLineEdit*>(fieldName + suffix);
|
||||
bool ok2 = false;
|
||||
val = (lineEditSize->displayText()).toULongLong(&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());
|
||||
val *= data.toULongLong();
|
||||
}
|
||||
|
@ -43,8 +43,6 @@ CreateChannel::CreateChannel()
|
||||
ui.headerFrame->setHeaderImage(QPixmap(":/images/add_channel64.png"));
|
||||
ui.headerFrame->setHeaderText(tr("New Channel"));
|
||||
|
||||
picture = NULL;
|
||||
|
||||
// connect up the buttons.
|
||||
connect( ui.buttonBox, SIGNAL(accepted()), this, SLOT(createChannel()));
|
||||
connect( ui.buttonBox, SIGNAL(rejected()), this, SLOT(close()));
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <QBuffer>
|
||||
#include <QMenu>
|
||||
#include <QDir>
|
||||
#include <QMimeData>
|
||||
|
||||
#include <gui/RetroShareLink.h>
|
||||
#include "CreateChannelMsg.h"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QDropEvent>
|
||||
#include <QUrl>
|
||||
#include <QFileInfo>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "DropLineEdit.h"
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include <QDropEvent>
|
||||
#include <QUrl>
|
||||
#include <QTimer>
|
||||
#include <QMimeData>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -409,7 +409,7 @@ void GraphWidget::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight());
|
||||
gradient.setColorAt(0, Qt::white);
|
||||
gradient.setColorAt(1, Qt::lightGray);
|
||||
painter->fillRect(rect.intersect(sceneRect), gradient);
|
||||
painter->fillRect(rect.intersected(sceneRect), gradient);
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->drawRect(sceneRect);
|
||||
|
||||
|
@ -32,8 +32,8 @@ IMHistoryItemDelegate::IMHistoryItemDelegate(QWidget *parent)
|
||||
|
||||
void IMHistoryItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
if (qVariantCanConvert<IMHistoryItemPainter>(index.data())) {
|
||||
IMHistoryItemPainter itemPainter = qVariantValue<IMHistoryItemPainter>(index.data());
|
||||
if (index.data().canConvert<IMHistoryItemPainter>()) {
|
||||
IMHistoryItemPainter itemPainter = index.data().value<IMHistoryItemPainter>();
|
||||
itemPainter.paint(painter, option, IMHistoryItemPainter::ReadOnly);
|
||||
} else {
|
||||
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
|
||||
{
|
||||
if (qVariantCanConvert<IMHistoryItemPainter>(index.data())) {
|
||||
IMHistoryItemPainter painter = qVariantValue<IMHistoryItemPainter>(index.data());
|
||||
if (index.data().canConvert<IMHistoryItemPainter>()) {
|
||||
IMHistoryItemPainter painter = index.data().value<IMHistoryItemPainter>();
|
||||
return painter.sizeHint();
|
||||
} else {
|
||||
return QItemDelegate::sizeHint(option, index);
|
||||
|
@ -281,7 +281,7 @@ ChatPage::save(QString &/*errmsg*/)
|
||||
ChatStyleInfo info;
|
||||
QListWidgetItem *item = ui.publicList->currentItem();
|
||||
if (item) {
|
||||
info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole));
|
||||
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
|
||||
if (publicStylePath != info.stylePath || publicStyleVariant != ui.publicComboBoxVariant->currentText()) {
|
||||
Settings->setPublicChatStyle(info.stylePath, ui.publicComboBoxVariant->currentText());
|
||||
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PUBLIC);
|
||||
@ -290,7 +290,7 @@ ChatPage::save(QString &/*errmsg*/)
|
||||
|
||||
item = ui.privateList->currentItem();
|
||||
if (item) {
|
||||
info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole));
|
||||
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
|
||||
if (privateStylePath != info.stylePath || privateStyleVariant != ui.privateComboBoxVariant->currentText()) {
|
||||
Settings->setPrivateChatStyle(info.stylePath, ui.privateComboBoxVariant->currentText());
|
||||
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_PRIVATE);
|
||||
@ -299,7 +299,7 @@ ChatPage::save(QString &/*errmsg*/)
|
||||
|
||||
item = ui.historyList->currentItem();
|
||||
if (item) {
|
||||
info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole));
|
||||
info = item->data(Qt::UserRole).value<ChatStyleInfo>();
|
||||
if (historyStylePath != info.stylePath || historyStyleVariant != ui.historyComboBoxVariant->currentText()) {
|
||||
Settings->setHistoryChatStyle(info.stylePath, ui.historyComboBoxVariant->currentText());
|
||||
NotifyQt::getInstance()->notifyChatStyleChanged(ChatStyle::TYPE_HISTORY);
|
||||
@ -476,7 +476,7 @@ void ChatPage::fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBr
|
||||
{
|
||||
QListWidgetItem *item = listWidget->currentItem();
|
||||
if (item) {
|
||||
ChatStyleInfo info = qVariantValue<ChatStyleInfo>(item->data(Qt::UserRole));
|
||||
ChatStyleInfo info = item->data(Qt::UserRole).value<ChatStyleInfo>();
|
||||
|
||||
setPreviewMessages(info.stylePath, comboBox->currentText(), textBrowser);
|
||||
} else {
|
||||
@ -488,7 +488,7 @@ void ChatPage::on_publicList_currentRowChanged(int currentRow)
|
||||
{
|
||||
if (currentRow != -1) {
|
||||
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;
|
||||
if (info.authorEmail.isEmpty() == false) {
|
||||
@ -524,7 +524,7 @@ void ChatPage::on_privateList_currentRowChanged(int currentRow)
|
||||
{
|
||||
if (currentRow != -1) {
|
||||
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;
|
||||
if (info.authorEmail.isEmpty() == false) {
|
||||
@ -560,7 +560,7 @@ void ChatPage::on_historyList_currentRowChanged(int currentRow)
|
||||
{
|
||||
if (currentRow != -1) {
|
||||
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;
|
||||
if (info.authorEmail.isEmpty() == false) {
|
||||
|
@ -764,7 +764,7 @@ bool RsHtml::makeEmbeddedImage(const QImage &originalImage, QString &embeddedIma
|
||||
|
||||
// ask user
|
||||
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.setDefaultButton(QMessageBox::Ok);
|
||||
if (msgBox.exec() != QMessageBox::Ok) {
|
||||
|
@ -21,7 +21,8 @@
|
||||
|
||||
#include <util/RetroStyleLabel.h>
|
||||
|
||||
#include <QtGui>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
|
||||
RetroStyleLabel::RetroStyleLabel(QWidget * parent, Mode mode, Qt::AlignmentFlag hAlign)
|
||||
: QLabel(parent), _mode(mode) {
|
||||
|
@ -17,22 +17,24 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <util/Widget.h>
|
||||
|
||||
#include <QtGui>
|
||||
|
||||
QGridLayout * Widget::createLayout(QWidget * parent) {
|
||||
QGridLayout * layout = new QGridLayout(parent);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
return layout;
|
||||
}
|
||||
|
||||
QDialog * Widget::transformToWindow(QWidget * widget) {
|
||||
QDialog * dialog = new QDialog(widget->parentWidget());
|
||||
widget->setParent(NULL);
|
||||
createLayout(dialog)->addWidget(widget);
|
||||
return dialog;
|
||||
}
|
||||
****************************************************************/
|
||||
|
||||
#include <util/Widget.h>
|
||||
|
||||
#include <QDialog>
|
||||
#include <QWidget>
|
||||
#include <QGridLayout>
|
||||
|
||||
QGridLayout * Widget::createLayout(QWidget * parent) {
|
||||
QGridLayout * layout = new QGridLayout(parent);
|
||||
layout->setSpacing(0);
|
||||
layout->setMargin(0);
|
||||
return layout;
|
||||
}
|
||||
|
||||
QDialog * Widget::transformToWindow(QWidget * widget) {
|
||||
QDialog * dialog = new QDialog(widget->parentWidget());
|
||||
widget->setParent(NULL);
|
||||
createLayout(dialog)->addWidget(widget);
|
||||
return dialog;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user