Commit ba77995f authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Convert to new connect api

parent 6543ceb9
......@@ -123,15 +123,13 @@ HostConnector::HostConnector( QWidget *parent, const char *name )
layout->addWidget( group, 1, 0, 1, 2 );
connect( mUseCustom, SIGNAL(toggled(bool)),
mCommands, SLOT(setEnabled(bool)) );
connect( mUseDaemon, SIGNAL(toggled(bool)),
mPort, SLOT(setEnabled(bool)) );
connect(mUseCustom, &QRadioButton::toggled, mCommands, &KComboBox::setEnabled);
connect(mUseDaemon, &QRadioButton::toggled, mPort, &KIntSpinBox::setEnabled);
connect( mHostNames->lineEdit(), SIGNAL(textChanged(QString)),
this, SLOT(slotHostNameChanged(QString)) );
enableButtonOk( !mHostNames->lineEdit()->text().isEmpty() );
KAcceleratorManager::manage( this );
connect(this,SIGNAL(helpClicked()),this,SLOT(slotHelp()));
connect(this, &HostConnector::helpClicked, this, &HostConnector::slotHelp);
}
HostConnector::~HostConnector()
......
......@@ -428,19 +428,19 @@ SensorBrowserTreeWidget::SensorBrowserTreeWidget( QWidget* parent, KSGRD::Sensor
mSortFilterProxyModel.setSourceModel(&mSensorBrowserModel);
mSortFilterProxyModel.setShowAllChildren(true);
setModel(&mSortFilterProxyModel);
connect( mSensorManager, SIGNAL(update()), &mSensorBrowserModel, SLOT(update()) );
connect( mSensorManager, SIGNAL(hostAdded(KSGRD::SensorAgent*,QString)), &mSensorBrowserModel, SLOT(hostAdded(KSGRD::SensorAgent*,QString)) );
connect( mSensorManager, SIGNAL(hostConnectionLost(QString)), &mSensorBrowserModel, SLOT(hostRemoved(QString)) );
connect(mSensorManager, &KSGRD::SensorManager::update, &mSensorBrowserModel, &SensorBrowserModel::update);
connect(mSensorManager, &KSGRD::SensorManager::hostAdded, &mSensorBrowserModel, &SensorBrowserModel::hostAdded);
connect(mSensorManager, &KSGRD::SensorManager::hostConnectionLost, &mSensorBrowserModel, &SensorBrowserModel::hostRemoved);
// connect( mSensorManager, SIGNAL(hostAdded(KSGRD::SensorAgent*,QString)), SLOT(updateView()) );
// connect( mSensorManager, SIGNAL(hostConnectionLost(QString)), SLOT(updateView()) );
connect( &mSortFilterProxyModel, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(updateView()) );
connect(&mSortFilterProxyModel, &KSortFilterProxyModel::rowsInserted, this, &SensorBrowserTreeWidget::updateView);
setDragDropMode(QAbstractItemView::DragOnly);
setUniformRowHeights(true);
//setMinimumWidth( 1 );
retranslateUi();
connect( &mSensorBrowserModel, SIGNAL(sensorsAddedToHost(QModelIndex)), this, SLOT(expandItem(QModelIndex)));
connect(&mSensorBrowserModel, &SensorBrowserModel::sensorsAddedToHost, this, &SensorBrowserTreeWidget::expandItem);
KSGRD::SensorManagerIterator it( mSensorManager );
while ( it.hasNext() ) {
......
......@@ -208,12 +208,10 @@ DancingBarsSettings::DancingBarsSettings( QWidget* parent, const char* name )
mRemoveButton->setWhatsThis( i18n( "Push this button to delete the sensor." ) );
pageLayout->addWidget( mRemoveButton, 1, 1 );
connect( mUseLowerLimit, SIGNAL(toggled(bool)),
mLowerLimit, SLOT(setEnabled(bool)) );
connect( mUseUpperLimit, SIGNAL(toggled(bool)),
mUpperLimit, SLOT(setEnabled(bool)) );
connect( mEditButton, SIGNAL(clicked()), SLOT(editSensor()) );
connect( mRemoveButton, SIGNAL(clicked()), SLOT(removeSensor()) );
connect(mUseLowerLimit, &QCheckBox::toggled, mLowerLimit, &QDoubleSpinBox::setEnabled);
connect(mUseUpperLimit, &QCheckBox::toggled, mUpperLimit, &QDoubleSpinBox::setEnabled);
connect(mEditButton, &QPushButton::clicked, this, &DancingBarsSettings::editSensor);
connect(mRemoveButton, &QPushButton::clicked, this, &DancingBarsSettings::removeSensor);
KAcceleratorManager::manage( this );
......
......@@ -209,7 +209,7 @@ FancyPlotter::FancyPlotter( QWidget* parent,
mPlotter->installEventFilter( this );
setPlotterWidget( mPlotter );
connect(mPlotter, SIGNAL(axisScaleChanged()), this, SLOT(plotterAxisScaleChanged()));
connect(mPlotter, &KSignalPlotter::axisScaleChanged, this, &FancyPlotter::plotterAxisScaleChanged);
QDomElement emptyElement;
restoreSettings(emptyElement);
}
......@@ -289,9 +289,9 @@ void FancyPlotter::configureSettings()
mSettingsDialog->setSensors( list );
mSettingsDialog->setHasIntegerRange( hasIntegerRange );
connect( mSettingsDialog, SIGNAL(applyClicked()), this, SLOT(applySettings()) );
connect( mSettingsDialog, SIGNAL(okClicked()), this, SLOT(applySettings()) );
connect( mSettingsDialog, SIGNAL(finished(int)), this, SLOT(settingsFinished()) );
connect(mSettingsDialog, &FancyPlotterSettings::applyClicked, this, &FancyPlotter::applySettings);
connect(mSettingsDialog, &FancyPlotterSettings::okClicked, this, &FancyPlotter::applySettings);
connect(mSettingsDialog, &FancyPlotterSettings::finished, this, &FancyPlotter::settingsFinished);
mSettingsDialog->show();
}
......@@ -618,7 +618,7 @@ void FancyPlotter::timerTick() //virtual
void FancyPlotter::plotterAxisScaleChanged()
{
//Prevent this being called recursively
disconnect(mPlotter, SIGNAL(axisScaleChanged()), this, SLOT(plotterAxisScaleChanged()));
disconnect(mPlotter, &KSignalPlotter::axisScaleChanged, this, &FancyPlotter::plotterAxisScaleChanged);
KLocalizedString unit;
double value = mPlotter->currentMaximumRangeValue();
if(mUnit == "KiB") {
......@@ -666,7 +666,7 @@ void FancyPlotter::plotterAxisScaleChanged()
}
mPlotter->setUnit(unit);
//reconnect
connect(mPlotter, SIGNAL(axisScaleChanged()), this, SLOT(plotterAxisScaleChanged()));
connect(mPlotter, &KSignalPlotter::axisScaleChanged, this, &FancyPlotter::plotterAxisScaleChanged);
}
void FancyPlotter::answerReceived( int id, const QList<QByteArray> &answerlist )
{
......
......@@ -214,7 +214,7 @@ FancyPlotterSettings::FancyPlotterSettings( QWidget* parent, bool locked )
mView->hideColumn(0);
pageLayout->addWidget( mView, 0, 0, 6, 1 );
connect(mView,SIGNAL(doubleClicked(QModelIndex)), this, SLOT(editSensor()));
connect(mView, &QTreeView::doubleClicked, this, &FancyPlotterSettings::editSensor);
mEditButton = new QPushButton( i18n( "Set Color..." ), page );
mEditButton->setWhatsThis( i18n( "Push this button to configure the color of the sensor in the diagram." ) );
......@@ -227,37 +227,31 @@ FancyPlotterSettings::FancyPlotterSettings( QWidget* parent, bool locked )
mRemoveButton = new QPushButton( i18n( "Delete" ), page );
mRemoveButton->setWhatsThis( i18n( "Push this button to delete the sensor." ) );
pageLayout->addWidget( mRemoveButton, 1, 1 );
connect( mRemoveButton, SIGNAL(clicked()), SLOT(removeSensor()) );
connect(mRemoveButton, &QPushButton::clicked, this, &FancyPlotterSettings::removeSensor);
mMoveUpButton = new QPushButton( i18n( "Move Up" ), page );
mMoveUpButton->setEnabled( false );
pageLayout->addWidget( mMoveUpButton, 2, 1 );
connect( mMoveUpButton, SIGNAL(clicked()), SLOT(moveUpSensor()) );
connect(mMoveUpButton, &QPushButton::clicked, this, &FancyPlotterSettings::moveUpSensor);
mMoveDownButton = new QPushButton( i18n( "Move Down" ), page );
mMoveDownButton->setEnabled( false );
pageLayout->addWidget( mMoveDownButton, 3, 1 );
connect( mMoveDownButton, SIGNAL(clicked()), SLOT(moveDownSensor()) );
connect(mMoveDownButton, &QPushButton::clicked, this, &FancyPlotterSettings::moveDownSensor);
connect(mView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(selectionChanged(QModelIndex)));
}
connect( mManualRange, SIGNAL(toggled(bool)), mMinValue,
SLOT(setEnabled(bool)) );
connect( mManualRange, SIGNAL(toggled(bool)), mMaxValue,
SLOT(setEnabled(bool)) );
connect( mManualRange, SIGNAL(toggled(bool)), mMinValueLabel,
SLOT(setEnabled(bool)) );
connect( mManualRange, SIGNAL(toggled(bool)), mMaxValueLabel,
SLOT(setEnabled(bool)) );
connect(mManualRange, &QCheckBox::toggled, mMinValue, &QDoubleSpinBox::setEnabled);
connect(mManualRange, &QCheckBox::toggled, mMaxValue, &QDoubleSpinBox::setEnabled);
connect(mManualRange, &QCheckBox::toggled, mMinValueLabel, &QLabel::setEnabled);
connect(mManualRange, &QCheckBox::toggled, mMaxValueLabel, &QLabel::setEnabled);
connect( mShowVerticalLines, SIGNAL(toggled(bool)), mVerticalLinesDistance,
SLOT(setEnabled(bool)) );
connect( mShowVerticalLines, SIGNAL(toggled(bool)), mVerticalLinesScroll,
SLOT(setEnabled(bool)) );
connect(mShowVerticalLines, &QCheckBox::toggled, mVerticalLinesDistance, &KIntNumInput::setEnabled);
connect(mShowVerticalLines, &QCheckBox::toggled, mVerticalLinesScroll, &QCheckBox::setEnabled);
connect( mEditButton, SIGNAL(clicked()), SLOT(editSensor()) );
connect(mEditButton, &QPushButton::clicked, this, &FancyPlotterSettings::editSensor);
KAcceleratorManager::manage( this );
}
......@@ -449,7 +443,7 @@ void FancyPlotterSettings::editSensor()
SensorModelEntry sensor = mModel->sensor( index );
KColorDialog dialog(this, true);
connect(&dialog, SIGNAL(colorSelected(QColor)), this, SLOT(setColorForSelectedItem(QColor)));
connect(&dialog, &KColorDialog::colorSelected, this, &FancyPlotterSettings::setColorForSelectedItem);
QColor color = sensor.color();
dialog.setColor(color);
int result = dialog.exec();
......
......@@ -100,7 +100,7 @@ ListView::ListView(QWidget* parent, const QString& title, SharedSettings *workSh
mView->setContextMenuPolicy( Qt::CustomContextMenu );
mView->header()->setContextMenuPolicy( Qt::CustomContextMenu );
connect(mView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
connect(mView, &QTreeView::customContextMenuRequested, this, &ListView::showContextMenu);
connect(mView->header(), SIGNAL(customContextMenuRequested(QPoint)), SLOT(showColumnContextMenu(QPoint)));
mView->setAlternatingRowColors(true);
......@@ -400,7 +400,7 @@ ListView::configureSettings()
{
lvs = new ListViewSettings(this, "ListViewSettings");
Q_CHECK_PTR(lvs);
connect(lvs, SIGNAL(applyClicked()), SLOT(applySettings()));
connect(lvs, &ListViewSettings::applyClicked, this, &ListView::applySettings);
/* QPalette pal = monitor->palette();
lvs->setGridColor(pal.color(QPalette::Link));
......
......@@ -54,7 +54,7 @@ LogFile::LogFile(QWidget *parent, const QString& title, SharedSettings *workShee
setMinimumSize(50, 25);
monitor->setContextMenuPolicy( Qt::CustomContextMenu );
connect(monitor, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
connect(monitor, &QListWidget::customContextMenuRequested, this, &LogFile::showContextMenu);
setPlotterWidget(monitor);
}
......@@ -104,15 +104,15 @@ void LogFile::configureSettings(void)
lfs->ruleList->addItems(filterRules);
lfs->title->setText(title());
connect(&dlg, SIGNAL(okClicked()), &dlg, SLOT(accept()));
connect(&dlg, SIGNAL(applyClicked()), this, SLOT(applySettings()));
connect(&dlg, &KDialog::okClicked, &dlg, &KDialog::accept);
connect(&dlg, &KDialog::applyClicked, this, &LogFile::applySettings);
connect(lfs->addButton, SIGNAL(clicked()), this, SLOT(settingsAddRule()));
connect(lfs->deleteButton, SIGNAL(clicked()), this, SLOT(settingsDeleteRule()));
connect(lfs->changeButton, SIGNAL(clicked()), this, SLOT(settingsChangeRule()));
connect(lfs->ruleList, SIGNAL(currentRowChanged(int)), this, SLOT(settingsRuleListSelected(int)));
connect(lfs->ruleText, SIGNAL(returnPressed()), this, SLOT(settingsAddRule()));
connect(lfs->ruleText, SIGNAL(textChanged(QString)), this, SLOT(settingsRuleTextChanged()));
connect(lfs->addButton, &QPushButton::clicked, this, &LogFile::settingsAddRule);
connect(lfs->deleteButton, &QPushButton::clicked, this, &LogFile::settingsDeleteRule);
connect(lfs->changeButton, &QPushButton::clicked, this, &LogFile::settingsChangeRule);
connect(lfs->ruleList, &QListWidget::currentRowChanged, this, &LogFile::settingsRuleListSelected);
connect(lfs->ruleText, &KLineEdit::returnPressed, this, &LogFile::settingsAddRule);
connect(lfs->ruleText, &KLineEdit::textChanged, this, &LogFile::settingsRuleTextChanged);
settingsRuleListSelected(lfs->ruleList->currentRow());
settingsRuleTextChanged();
......
......@@ -149,10 +149,10 @@ bool ProcessController::addSensor(const QString& hostName,
mProcessList->setContentsMargins(0,0,0,0);
mProcessList->setScriptingEnabled(true);
addActions(mProcessList->actions());
connect(mProcessList, SIGNAL(updated()), this, SIGNAL(updated()));
connect(mProcessList, SIGNAL(processListChanged()), this, SIGNAL(processListChanged()));
connect(mProcessList, &KSysGuardProcessList::updated, this, &ProcessController::updated);
connect(mProcessList, &KSysGuardProcessList::processListChanged, this, &ProcessController::processListChanged);
mProcessList->setContextMenuPolicy( Qt::CustomContextMenu );
connect(mProcessList, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
connect(mProcessList, &KSysGuardProcessList::customContextMenuRequested, this, &ProcessController::showContextMenu);
layout->addWidget(mProcessList);
......@@ -162,7 +162,7 @@ bool ProcessController::addSensor(const QString& hostName,
KSysGuard::Processes *processes = mProcessList->processModel()->processController();
mProcesses = processes;
if(processes) {
connect( processes, SIGNAL(runCommand(QString,int)), SLOT(runCommand(QString,int)));
connect(processes, &KSysGuard::Processes::runCommand, this, &ProcessController::runCommand);
}
}
......
......@@ -37,7 +37,7 @@ SensorLoggerDlg::SensorLoggerDlg( QWidget *parent, const char *name )
m_loggerWidget = new Ui_SensorLoggerDlgWidget;
m_loggerWidget->setupUi( main );
m_loggerWidget->m_fileName->setMode(KFile::File|KFile::LocalOnly);
connect(m_loggerWidget->m_fileName, SIGNAL(textChanged(QString)), SLOT(fileNameTextChanged()));
connect(m_loggerWidget->m_fileName, &KUrlRequester::textChanged, this, &SensorLoggerDlg::fileNameTextChanged);
setMainWidget( main );
fileNameTextChanged();
......
......@@ -60,8 +60,7 @@ TimerSettings::TimerSettings( QWidget *parent, const char *name )
mLabel->setBuddy( mInterval );
mInterval->setWhatsThis( i18n( "All displays of the sheet are updated at the rate specified here." ) );
connect( mUseGlobalUpdate, SIGNAL(toggled(bool)),
SLOT(globalUpdateChanged(bool)) );
connect(mUseGlobalUpdate, &QCheckBox::toggled, this, &TimerSettings::globalUpdateChanged);
mUseGlobalUpdate->setChecked( true );
......
......@@ -352,7 +352,7 @@ KSGRD::SensorDisplay* WorkSheet::insertDisplay( DisplayType displayType, QString
return NULL;
}
newDisplay->applyStyle();
connect(&mTimer, SIGNAL(timeout()), newDisplay, SLOT(timerTick()));
connect(&mTimer, &QTimer::timeout, newDisplay, &KSGRD::SensorDisplay::timerTick);
replaceDisplay( row, column, newDisplay, rowSpan, columnSpan );
return newDisplay;
}
......@@ -624,14 +624,14 @@ void WorkSheet::replaceDisplay( int row, int column, KSGRD::SensorDisplay* newDi
if (newDisplay->metaObject()->className() != QByteArray("DummyDisplay"))
{
connect(newDisplay, SIGNAL(showPopupMenu(KSGRD::SensorDisplay*)), SLOT(showPopupMenu(KSGRD::SensorDisplay*)));
connect(newDisplay, &KSGRD::SensorDisplay::showPopupMenu, this, &WorkSheet::showPopupMenu);
newDisplay->setDeleteNotifier(this);
}
// if there's only item, the tab's title should be the widget's title
if (row == 0 && mRows == rowSpan && column == 0 && mColumns == columnSpan)
{
connect(newDisplay, SIGNAL(titleChanged(QString)), SLOT(setTitle(QString)));
connect(newDisplay, &KSGRD::SensorDisplay::titleChanged, this, &WorkSheet::setTitle);
setTitle(newDisplay->title());
}
if (isVisible())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment