Commit 551b41c7 authored by Yuri Chornoivan's avatar Yuri Chornoivan
Browse files

Port KmPlot away from deprecated KStatusBar and kdelibs4support at all

Differential Revision: https://phabricator.kde.org/D16133
parent 5ec2e1db
......@@ -21,7 +21,6 @@ find_package (KF5 REQUIRED
Parts
WidgetsAddons
DocTools
KDELibs4Support
DBusAddons
)
......
......@@ -61,7 +61,7 @@ add_library(kmplotpart MODULE ${kmplotpart_PART_SRCS})
target_link_libraries(kmplotpart KF5::KDELibs4Support KF5::Parts Qt5::Svg)
target_link_libraries(kmplotpart Qt5::PrintSupport Qt5::Widgets KF5::Parts Qt5::Svg)
install(TARGETS kmplotpart DESTINATION ${PLUGIN_INSTALL_DIR} )
......@@ -78,7 +78,7 @@ ecm_add_app_icon(kmplot_SRCS ICONS ${ICONS_SRCS})
add_executable(kmplot ${kmplot_SRCS})
target_link_libraries(kmplot KF5::Crash KF5::KDELibs4Support KF5::Parts KF5::DBusAddons)
target_link_libraries(kmplot Qt5::PrintSupport Qt5::Widgets KF5::Crash KF5::Parts KF5::DBusAddons)
install(TARGETS kmplot ${INSTALL_TARGETS_DEFAULT_ARGS} )
......
......@@ -34,9 +34,8 @@
#include "view.h"
#include "xparser.h"
#include <kaction.h>
#include <kcolorbutton.h>
#include <kmessagebox.h>
#include <KColorButton>
#include <KMessageBox>
#include <QRadioButton>
#include <QTimer>
......
......@@ -29,16 +29,13 @@
#include "xparser.h"
#include <QDebug>
#include <kinputdialog.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <qdom.h>
#include <QDialogButtonBox>
#include <QStandardPaths>
#include <QTimer>
#include <assert.h>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <KMessageBox>
#include "ui_constantseditor.h"
......
......@@ -24,24 +24,26 @@
#include "kmplot.h"
#include <kconfig.h>
#include <kconfiggroup.h>
#include <kedittoolbar.h>
#include <kshortcutsdialog.h>
#include <klibloader.h>
#include <kmessagebox.h>
#include <kmplotprogress.h>
#include <kstatusbar.h>
#include <kstandardaction.h>
#include <kurl.h>
#include <kactioncollection.h>
#include "maindlg.h"
#include <ktoolinvocation.h>
#include <ktogglefullscreenaction.h>
#include <KConfigGroup>
#include <QFileDialog>
#include <QLabel>
#include <QStatusBar>
#include <QUrl>
#include <KActionCollection>
#include <KConfig>
#include <KConfigGroup>
#include <KLocalizedString>
#include <KMessageBox>
#include <KPluginLoader>
#include <KShortcutsDialog>
#include <KStandardAction>
#include <KToggleFullScreenAction>
#include <KToolInvocation>
#include "maindlg.h"
#include <kmplotprogress.h>
#include "kmplotadaptor.h"
#include "view.h"
static QUrl urlFromArg(const QString &arg)
{
......@@ -246,22 +248,31 @@ bool KmPlot::queryClose()
void KmPlot::setStatusBarText(const QString &text, int id)
{
static_cast<KStatusBar *>(statusBar())->changeItem(text,id);
static_cast<QLabel *>(statusBarLabels.at(id))->setText(text);
}
void KmPlot::setupStatusBar()
{
KStatusBar *statusBar = new KStatusBar(this);
QStatusBar *statusBar = new QStatusBar(this);
setStatusBar(statusBar);
statusBar->insertFixedItem( "1234567890123456", 1 );
statusBar->insertFixedItem( "1234567890123456", 2 );
statusBar->insertItem( "", 3, 3 );
statusBar->insertItem( "", 4 );
statusBar->changeItem( "", 1 );
statusBar->changeItem( "", 2 );
statusBar->setItemAlignment( 3, Qt::AlignLeft );
for (int i = 0; i < View::SectionCount; ++i)
{
QLabel *label = new QLabel (statusBar);
label->setFixedHeight (label->fontMetrics ().height () + 2);
/// Labels for coordinates should be of fixed width 16 chars to be the same as for good old KmPlot
if ( i < 2) {
label->setFixedWidth ( label->fontMetrics ().width (QLatin1Char ('8')) * 16 );
label->setAlignment( Qt::AlignCenter );
}
else {
label->setAlignment( Qt::AlignLeft );
}
statusBar->addWidget (label);
statusBarLabels.append (label);
}
m_progressBar = new KmPlotProgress( statusBar );
m_progressBar->setMaximumHeight( statusBar->height()-10 );
......
......@@ -29,6 +29,7 @@
#include <kparts/readwritepart.h>
class QCommandLineParser;
class QLabel;
class KmPlotProgress;
class KToggleFullScreenAction;
......@@ -104,6 +105,8 @@ private:
KToggleFullScreenAction* m_fullScreen;
/// The progress bar for drawing functions
KmPlotProgress * m_progressBar;
/// The labels set to show information on the statusbar
QList<QLabel *> statusBarLabels;
};
#endif // KMPLOT_H_
......@@ -25,7 +25,7 @@
#ifndef KMPLOTIO_H
#define KMPLOTIO_H
#include <kurl.h>
#include <QUrl>
#include <QGradient>
class Equation;
......
......@@ -37,7 +37,6 @@
#include <QVBoxLayout>
#include <KConfigGroup>
#include <KIO/StoredTransferJob>
#include <KInputDialog>
#include <KJobWidgets>
#include <KMessageBox>
......
......@@ -37,29 +37,23 @@
#include <QPixmap>
#include <QPrintDialog>
#include <QPrinter>
#include <QStandardPaths>
#include <QSvgGenerator>
#include <QTemporaryFile>
#include <QTimer>
// KDE includes
#include <k4aboutdata.h>
#include <kconfigdialog.h>
#include <kconfigdialogmanager.h>
#include <kedittoolbar.h>
#include <KActionCollection>
#include <KConfigDialog>
#include <KConfigDialogManager>
#include <KHelpClient>
#include <KIO/StatJob>
#include <kcomponentdata.h>
#include <klineedit.h>
#include <kmessagebox.h>
#include <kstandarddirs.h>
#include <kstandardaction.h>
#include <ktoolbar.h>
#include <ktoolinvocation.h>
#include <krecentfilesaction.h>
#include <kactioncollection.h>
#include <khelpclient.h>
#include <kiconloader.h>
#include <kapplication.h>
#include <KIO/StoredTransferJob>
#include <KLineEdit>
#include <KMessageBox>
#include <KStandardAction>
#include <KToolBar>
#include <KToolInvocation>
// local includes
#include "calculator.h"
......
......@@ -30,16 +30,16 @@
// Qt includes
#include <QDomDocument>
#include <QStack>
#include <QMenu>
#include <QStack>
#include <QStandardPaths>
// KDE includes
#include <ksharedconfig.h>
#include <kstandarddirs.h>
#include <kparts/browserextension.h>
#include <kparts/part.h>
#include <kparts/readwritepart.h>
#include <kparts/factory.h>
#include <KSharedConfig>
#include <KParts/BrowserExtension>
#include <KParts/Part>
#include <KParts/ReadWritePart>
#include <KPluginFactory>
#undef GrayScale
......
......@@ -29,30 +29,27 @@
// Qt includes
#include <QAbstractTextDocumentLayout>
#include <qbitmap.h>
#include <qcursor.h>
#include <qdatastream.h>
#include <QPainter>
#include <qslider.h>
#include <qtimer.h>
#include <QPixmap>
#include <QPaintEvent>
#include <QKeyEvent>
#include <QBitmap>
#include <QCursor>
#include <QDataStream>
#include <QDebug>
#include <QEvent>
#include <QKeyEvent>
#include <QList>
#include <QMenu>
#include <QMouseEvent>
#include <QPaintEvent>
#include <QPainter>
#include <QPixmap>
#include <QResizeEvent>
#include <QSlider>
#include <QTextEdit>
#include <QTime>
#include <QMenu>
#include <QMouseEvent>
#include <QTimer>
// KDE includes
#include <kaction.h>
#include <kactioncollection.h>
#include <QDebug>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <kmenu.h>
#include <KActionCollection>
#include <KMessageBox>
// local includes
#include "functioneditor.h"
......
......@@ -192,6 +192,18 @@ class View : public QWidget
void setPrintBackground( bool status );
void setPrintWidth( double width );
void setPrintHeight( double height );
/**
* Which part of the status bar.
*/
enum StatusBarSection
{
XSection = 0,
YSection = 1,
RootSection = 2,
FunctionSection = 3,
SectionCount = 4
};
public slots:
/// Called when the user want to cancel the drawing
......@@ -387,16 +399,6 @@ class View : public QWidget
* [min,max].
*/
QList<double> findRoots( const Plot & plot, double min, double max, RootAccuracy accuracy );
/**
* Which part of the status bar.
*/
enum StatusBarSection
{
XSection = 1,
YSection = 2,
RootSection = 3,
FunctionSection = 4
};
/**
* Changes the text in the statusbar.
*/
......
......@@ -32,9 +32,8 @@
#include "maindlg.h"
// KDE includes
#include <kinputdialog.h>
#include <KLocalizedString>
#include <kmessagebox.h>
#include <KMessageBox>
#include <QList>
#include <QDebug>
......
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