mirror of
https://github.com/fwbuilder/fwbuilder
synced 2025-11-06 18:52:58 +01:00
refactor: Stop using deprecated methods (Qt 5.14)
This commit is contained in:
parent
6b986a1b81
commit
ded1340898
@ -44,6 +44,7 @@
|
||||
#include <QStringList>
|
||||
#include <QTextCodec>
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
|
||||
#include "../common/init.cpp"
|
||||
@ -78,7 +79,7 @@ int main(int argc, char **argv)
|
||||
{
|
||||
QCoreApplication app(argc, argv, false);
|
||||
|
||||
QTime total_time_timer;
|
||||
QElapsedTimer total_time_timer;
|
||||
total_time_timer.start();
|
||||
|
||||
// compilers always write file names into manifest in Utf8
|
||||
|
||||
@ -293,22 +293,28 @@ string OSConfigurator_linux24::printVlanInterfaceConfigurationCommands()
|
||||
QString sintf_name = subinterface->getName().c_str();
|
||||
QString vlan_name;
|
||||
QStringList supported_vlan_names;
|
||||
vlan_name.sprintf("vlan%04d", vlan_id);
|
||||
vlan_name = QString("vlan%1")
|
||||
.arg(vlan_id, 4, 10, QChar('0'));
|
||||
supported_vlan_names.append(vlan_name);
|
||||
if (vlan_name == sintf_name) name_type = "VLAN_PLUS_VID";
|
||||
else
|
||||
{
|
||||
vlan_name.sprintf("vlan%d", vlan_id);
|
||||
vlan_name = QString("vlan%1")
|
||||
.arg(vlan_id);
|
||||
supported_vlan_names.append(vlan_name);
|
||||
if (vlan_name == sintf_name) name_type = "VLAN_PLUS_VID_NO_PAD";
|
||||
else
|
||||
{
|
||||
vlan_name.sprintf("%s.%04d", iface->getName().c_str(), vlan_id);
|
||||
vlan_name = QString("vlan%1.%2")
|
||||
.arg(iface->getName().c_str())
|
||||
.arg(vlan_id, 4, 10, QChar('0'));
|
||||
supported_vlan_names.append(vlan_name);
|
||||
if (vlan_name == sintf_name) name_type = "DEV_PLUS_VID_PAD";
|
||||
else
|
||||
{
|
||||
vlan_name.sprintf("%s.%d", iface->getName().c_str(), vlan_id);
|
||||
vlan_name = QString("vlan%1.%2")
|
||||
.arg(iface->getName().c_str())
|
||||
.arg(vlan_id);
|
||||
supported_vlan_names.append(vlan_name);
|
||||
if (vlan_name == sintf_name) name_type = "DEV_PLUS_VID_NO_PAD";
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ void ClusterInterfaceWidget::setFirewallList(QList<Firewall*> firewalls)
|
||||
Interface *iface = Interface::cast(*iter);
|
||||
//if (iface->isLoopback()) continue;
|
||||
QTreeWidgetItem *ifaceitem = new QTreeWidgetItem(firewall, QStringList() << QString::fromUtf8(iface->getName().c_str()));
|
||||
ifaceitem->setData(0, Qt::UserRole, qVariantFromValue(iface));//QVariant(QVariant::UserType, iface));
|
||||
ifaceitem->setData(0, Qt::UserRole, QVariant::fromValue(iface));//QVariant(QVariant::UserType, iface));
|
||||
ifaceitem->setIcon(0, QIcon(":/Icons/Interface/icon-tree"));
|
||||
ifaceitem->setDisabled(!interfaceSelectable(iface));
|
||||
if (!interfaceSelectable(iface))
|
||||
@ -113,7 +113,7 @@ void ClusterInterfaceWidget::setFirewallList(QList<Firewall*> firewalls)
|
||||
//if (iface->isLoopback()) return;
|
||||
Interface *subiface = Interface::cast(*iter2);
|
||||
QTreeWidgetItem *subitem = new QTreeWidgetItem(ifaceitem, QStringList() << QString::fromUtf8(subiface->getName().c_str()));
|
||||
subitem->setData(0, Qt::UserRole, qVariantFromValue(subiface));//QVariant(QVariant::UserType, subitem));
|
||||
subitem->setData(0, Qt::UserRole, QVariant::fromValue(subiface));//QVariant(QVariant::UserType, subitem));
|
||||
subitem->setDisabled(!interfaceSelectable(subiface));
|
||||
subitem->setIcon(0, QIcon(":/Icons/Interface/icon-tree"));
|
||||
if (!interfaceSelectable(subiface))
|
||||
|
||||
@ -355,7 +355,7 @@ QTreeWidgetItem* FindWhereUsedWidget::createQTWidgetItem(FWObject *o,
|
||||
item->setIcon(1, QIcon(parent_icon));
|
||||
item->setIcon(0, QIcon(object_icon));
|
||||
|
||||
item->setData(1, Qt::UserRole, qVariantFromValue((void*)container));
|
||||
item->setData(1, Qt::UserRole, QVariant::fromValue((void*)container));
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -58,10 +58,10 @@ KeywordsDialog::KeywordsDialog(FWObject *obj, QWidget *parent)
|
||||
m_allKeywords.insert(QString::fromUtf8((*iter).c_str()));
|
||||
}
|
||||
|
||||
m_allModel = new QStringListModel(sortStrings(m_allKeywords.toList()));
|
||||
m_allModel = new QStringListModel(sortStrings(m_allKeywords.values()));
|
||||
m_ui.allKeywordsListView->setModel(m_allModel);
|
||||
|
||||
m_currModel = new QStringListModel(sortStrings(m_currKeywords.toList()));
|
||||
m_currModel = new QStringListModel(sortStrings(m_currKeywords.values()));
|
||||
m_ui.currKeywordsListView->setModel(m_currModel);
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ void KeywordsDialog::gotAddClick()
|
||||
}
|
||||
}
|
||||
|
||||
m_currModel->setStringList(sortStrings(m_currKeywords.toList()));
|
||||
m_currModel->setStringList(sortStrings(m_currKeywords.values()));
|
||||
}
|
||||
|
||||
void KeywordsDialog::gotRemoveClick()
|
||||
@ -106,7 +106,7 @@ void KeywordsDialog::gotRemoveClick()
|
||||
}
|
||||
}
|
||||
|
||||
m_currModel->setStringList(sortStrings(m_currKeywords.toList()));
|
||||
m_currModel->setStringList(sortStrings(m_currKeywords.values()));
|
||||
}
|
||||
|
||||
|
||||
@ -124,8 +124,8 @@ void KeywordsDialog::gotNewKeywordClick()
|
||||
m_currKeywords.insert(newKeyword);
|
||||
m_allKeywords.insert(newKeyword);
|
||||
|
||||
m_currModel->setStringList(sortStrings(m_currKeywords.toList()));
|
||||
m_allModel->setStringList(sortStrings(m_allKeywords.toList()));
|
||||
m_currModel->setStringList(sortStrings(m_currKeywords.values()));
|
||||
m_allModel->setStringList(sortStrings(m_allKeywords.values()));
|
||||
|
||||
m_ui.newKeywordLineEdit->clear();
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ static void addKeywordsMenu(ObjectManipulator *om, QMenu *menu)
|
||||
removeKeywords->setDisabled(true);
|
||||
} else {
|
||||
data[0] = "remove";
|
||||
foreach (QString str, sortStrings(toRemove.toList())) {
|
||||
foreach (QString str, sortStrings(toRemove.values())) {
|
||||
QAction *act =
|
||||
removeKeywords->addAction(str, om, SLOT(processKeywordSlot()));
|
||||
data[1] = str;
|
||||
|
||||
@ -232,9 +232,9 @@ void ObjectManipulator::pasteObj()
|
||||
|
||||
// Check if we have already copied the same object before
|
||||
QString buff;
|
||||
buff.sprintf(".copy_of_%p", co->getRoot());
|
||||
buff.asprintf(".copy_of_%p", co->getRoot());
|
||||
string dedup_attribute = buff.toLatin1().constData();
|
||||
buff.sprintf("%d", co->getId());
|
||||
buff = QString::number(co->getId());
|
||||
QByteArray bytes = buff.toLatin1();
|
||||
FWObject *n_obj =
|
||||
target_object->getRoot()->findObjectByAttribute(dedup_attribute,
|
||||
|
||||
@ -198,7 +198,9 @@ RCSEnvFix::RCSEnvFix()
|
||||
|
||||
#endif
|
||||
|
||||
TZOffset.sprintf("%02d:%02d",tzoffset/60,tzoffset%60);
|
||||
TZOffset = QString("%1:%2")
|
||||
.arg(tzoffset / 60, 2, 10, QChar('0'))
|
||||
.arg(tzoffset % 60, 2, 10, QChar('0'));
|
||||
TZOffset = tzsign + TZOffset;
|
||||
|
||||
if (fwbdebug)
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#include <QRegExp>
|
||||
#include <QMessageBox>
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QtAlgorithms>
|
||||
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
@ -176,7 +177,7 @@ void RuleSetModel::initModel()
|
||||
RuleNode* node;
|
||||
RuleNode* group;
|
||||
|
||||
QTime t; t.start();
|
||||
QElapsedTimer t; t.start();
|
||||
for (FWObject::iterator i=ruleset->begin(); i!=ruleset->end(); i++, row++)
|
||||
{
|
||||
|
||||
@ -212,7 +213,7 @@ void RuleSetModel::initModel()
|
||||
}
|
||||
|
||||
}
|
||||
//if (fwbdebug) qDebug("Model init: %d ms", t.elapsed());
|
||||
if (fwbdebug) qDebug("Model init: %lld ms", t.elapsed());
|
||||
}
|
||||
|
||||
int RuleSetModel::rowCount(const QModelIndex &parent) const
|
||||
|
||||
@ -71,6 +71,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QHeaderView>
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
using namespace libfwbuilder;
|
||||
using namespace std;
|
||||
@ -171,16 +172,16 @@ void RuleSetView::init()
|
||||
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
QTime t; t.start();
|
||||
QElapsedTimer t; t.start();
|
||||
configureGroups();
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView configureGroups: %d ms", t.restart());
|
||||
qDebug("RuleSetView configureGroups: %lld ms", t.restart());
|
||||
restoreCollapsedGroups();
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView restoreCollapsedGroups: %d ms", t.restart());
|
||||
qDebug("RuleSetView restoreCollapsedGroups: %lld ms", t.restart());
|
||||
resizeColumns();
|
||||
if (fwbdebug)
|
||||
qDebug("RuleSetView resizeColumns: %d ms", t.restart());
|
||||
qDebug("RuleSetView resizeColumns: %lld ms", t.restart());
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
@ -2614,7 +2615,7 @@ void RuleSetView::restoreCollapsedGroups()
|
||||
{
|
||||
if (project)
|
||||
{
|
||||
QTime t;
|
||||
QElapsedTimer t;
|
||||
t.start();
|
||||
RuleSetModel* md = ((RuleSetModel*)model());
|
||||
QStringList collapsed_groups;
|
||||
@ -2622,7 +2623,7 @@ void RuleSetView::restoreCollapsedGroups()
|
||||
filename = project->getRCS()->getFileName();
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("restoreCollapsedGroups begin: %d ms", t.restart());
|
||||
qDebug("restoreCollapsedGroups begin: %lld ms", t.restart());
|
||||
|
||||
Firewall *f = md->getFirewall();
|
||||
if (f)
|
||||
@ -2633,14 +2634,14 @@ void RuleSetView::restoreCollapsedGroups()
|
||||
collapsed_groups);
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("restoreCollapsedGroups getCollapsedRuleGroups: %d ms", t.restart());
|
||||
qDebug("restoreCollapsedGroups getCollapsedRuleGroups: %lld ms", t.restart());
|
||||
|
||||
QList<QModelIndex> groups;
|
||||
md->getGroups(groups);
|
||||
|
||||
if (fwbdebug)
|
||||
{
|
||||
qDebug("restoreCollapsedGroups getGroups: %d ms", t.restart());
|
||||
qDebug("restoreCollapsedGroups getGroups: %lld ms", t.restart());
|
||||
qDebug() << "Groups:" << groups.size();
|
||||
}
|
||||
|
||||
@ -2651,7 +2652,7 @@ void RuleSetView::restoreCollapsedGroups()
|
||||
}
|
||||
|
||||
if (fwbdebug)
|
||||
qDebug("restoreCollapsedGroups foreach setExpanded: %d ms", t.restart());
|
||||
qDebug("restoreCollapsedGroups foreach setExpanded: %lld ms", t.restart());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ StartTipDialog::StartTipDialog(QWidget *parent): QDialog(parent)
|
||||
while (true)
|
||||
{
|
||||
QString tip_file;
|
||||
tip_file.sprintf("tip%02d.html", tip_no);
|
||||
tip_file = QString("tip%1.html").arg(tip_no, 2, 10, QChar('0'));
|
||||
QString contents;
|
||||
if (fwbdebug)
|
||||
qDebug("Trying tip file %s", tip_file.toLatin1().constData());
|
||||
|
||||
@ -27,6 +27,7 @@
|
||||
#include "UsageResolver.h"
|
||||
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QtDebug>
|
||||
|
||||
#include "fwbuilder/FWObjectDatabase.h"
|
||||
@ -135,7 +136,7 @@ list<Firewall*> UsageResolver::findFirewallsForObject(FWObject *o,
|
||||
list<Firewall *> fws;
|
||||
|
||||
set<FWObject *> resset;
|
||||
QTime tt;
|
||||
QElapsedTimer tt;
|
||||
tt.start();
|
||||
FWObject *f=o;
|
||||
while (f!=nullptr && !Firewall::cast(f)) f=f->getParent();
|
||||
|
||||
@ -68,6 +68,7 @@
|
||||
#include <QDateTime>
|
||||
#include <QtDebug>
|
||||
#include <QTime>
|
||||
#include <QElapsedTimer>
|
||||
#include <QWidget>
|
||||
|
||||
#include "fwbuilder/Resources.h"
|
||||
@ -770,7 +771,7 @@ bool instDialog::executeCommand(const QString &path, QStringList &args)
|
||||
// set codecs so that command line parameters can be encoded
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("Utf8"));
|
||||
enableStopButton();
|
||||
QTime start_time;
|
||||
QElapsedTimer start_time;
|
||||
start_time.start();
|
||||
proc.start(path, args);
|
||||
if ( !proc.waitForStarted() )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user