Fix some compile waynings and code formatting

pull/2/head
reionwong 4 years ago
parent 4027ad0b81
commit c539266ab2

@ -313,7 +313,7 @@ void HistoryScrollBuffer::addCellsVector(const QVector<Character>& cells)
void HistoryScrollBuffer::addCells(const Character a[], int count) void HistoryScrollBuffer::addCells(const Character a[], int count)
{ {
HistoryLine newLine(count); HistoryLine newLine(count);
qCopy(a,a+count,newLine.begin()); std::copy(a, a + count, newLine.begin());
addCellsVector(newLine); addCellsVector(newLine);
} }
@ -729,7 +729,7 @@ void CompactHistoryScroll::addCellsVector ( const TextLine& cells )
void CompactHistoryScroll::addCells ( const Character a[], int count ) void CompactHistoryScroll::addCells ( const Character a[], int count )
{ {
TextLine newLine (count); TextLine newLine (count);
qCopy ( a,a+count,newLine.begin() ); std::copy(a, a + count, newLine.begin());
addCellsVector(newLine); addCellsVector(newLine);
} }

@ -442,7 +442,7 @@ private:
uidLine = statusLine; uidLine = statusLine;
} while (!statusLine.isNull() && uidLine.isNull()); } while (!statusLine.isNull() && uidLine.isNull());
uidStrings << uidLine.split('\t', QString::SkipEmptyParts); uidStrings << uidLine.split('\t', Qt::SkipEmptyParts);
// Must be 5 entries: 'Uid: %d %d %d %d' and // Must be 5 entries: 'Uid: %d %d %d %d' and
// uid string must be less than 5 chars (uint) // uid string must be less than 5 chars (uint)
if (uidStrings.size() == 5) if (uidStrings.size() == 5)

File diff suppressed because it is too large Load Diff

@ -24,15 +24,12 @@
// Qt // Qt
#include <QColor> #include <QColor>
#include <QPointer> #include <QPointer>
//#include <QWidget>
#include <QQuickPaintedItem> #include <QQuickPaintedItem>
// Konsole // Konsole
#include "Filter.h" #include "Filter.h"
#include "Character.h" #include "Character.h"
#include "qtermwidget.h" #include "qtermwidget.h"
//#include "konsole_export.h"
#define KONSOLEPRIVATE_EXPORT
// QMLTermWidget // QMLTermWidget
#include "ksession.h" #include "ksession.h"
@ -44,21 +41,17 @@ class QDropEvent;
class QLabel; class QLabel;
class QTimer; class QTimer;
class QEvent; class QEvent;
class QGridLayout;
class QKeyEvent; class QKeyEvent;
class QScrollBar; class QScrollBar;
class QShowEvent; class QShowEvent;
class QHideEvent; class QHideEvent;
class QTimerEvent; class QTimerEvent;
class QWidget;
//class KMenu; //class KMenu;
namespace Konsole namespace Konsole
{ {
enum MotionAfterPasting {
enum MotionAfterPasting
{
// No move screenwindow after pasting // No move screenwindow after pasting
NoMoveScreenWindow = 0, NoMoveScreenWindow = 0,
// Move start of screenwindow after pasting // Move start of screenwindow after pasting
@ -67,7 +60,6 @@ namespace Konsole
MoveEndScreenWindow = 2 MoveEndScreenWindow = 2
}; };
extern unsigned short vt100_graphics[32]; extern unsigned short vt100_graphics[32];
class ScreenWindow; class ScreenWindow;
@ -81,7 +73,7 @@ class ScreenWindow;
* *
* TODO More documentation * TODO More documentation
*/ */
class KONSOLEPRIVATE_EXPORT TerminalDisplay : public QQuickPaintedItem class TerminalDisplay : public QQuickPaintedItem
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(KSession *session READ getSession WRITE setSession NOTIFY sessionChanged ) Q_PROPERTY(KSession *session READ getSession WRITE setSession NOTIFY sessionChanged )
@ -107,8 +99,8 @@ class KONSOLEPRIVATE_EXPORT TerminalDisplay : public QQuickPaintedItem
public: public:
/** Constructs a new terminal display widget with the specified parent. */ /** Constructs a new terminal display widget with the specified parent. */
TerminalDisplay(QQuickItem *parent=0); explicit TerminalDisplay(QQuickItem *parent = nullptr);
virtual ~TerminalDisplay(); ~TerminalDisplay() override;
/** Returns the terminal color palette used by the display. */ /** Returns the terminal color palette used by the display. */
const ColorEntry *colorTable() const; const ColorEntry *colorTable() const;
@ -131,8 +123,7 @@ public:
/** /**
* This enum describes the location where the scroll bar is positioned in the display widget. * This enum describes the location where the scroll bar is positioned in the display widget.
*/ */
enum ScrollBarPosition enum ScrollBarPosition {
{
/** Do not show the scroll bar. */ /** Do not show the scroll bar. */
NoScrollBar=0, NoScrollBar=0,
/** Show the scroll bar on the left side of the display. */ /** Show the scroll bar on the left side of the display. */
@ -214,8 +205,7 @@ public:
* This enum describes the methods for selecting text when * This enum describes the methods for selecting text when
* the user triple-clicks within the display. * the user triple-clicks within the display.
*/ */
enum TripleClickMode enum TripleClickMode {
{
/** Select the whole line underneath the cursor. */ /** Select the whole line underneath the cursor. */
SelectWholeLine, SelectWholeLine,
/** Select from the current cursor position to the end of the line. */ /** Select from the current cursor position to the end of the line. */
@ -348,8 +338,7 @@ public:
* can be used to alert the user when a 'bell' occurs in the terminal * can be used to alert the user when a 'bell' occurs in the terminal
* session. * session.
*/ */
enum BellMode enum BellMode {
{
/** A system beep. */ /** A system beep. */
SystemBeepBell=0, SystemBeepBell=0,
/** /**
@ -624,30 +613,30 @@ signals:
void boldIntenseChanged(); void boldIntenseChanged();
protected: protected:
virtual bool event( QEvent * ); bool event(QEvent *);
//virtual void paintEvent( QPaintEvent * ); //void paintEvent(QPaintEvent *);
virtual void showEvent(QShowEvent*); void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent*); void hideEvent(QHideEvent *);
virtual void resizeEvent(QResizeEvent*); void resizeEvent(QResizeEvent *);
virtual void fontChange(const QFont &font); virtual void fontChange(const QFont &font);
virtual void focusInEvent(QFocusEvent* event); void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent* event); void focusOutEvent(QFocusEvent *event);
virtual void keyPressEvent(QKeyEvent* event); void keyPressEvent(QKeyEvent *event);
virtual void mouseDoubleClickEvent(QMouseEvent* ev); void mouseDoubleClickEvent(QMouseEvent *ev);
virtual void mousePressEvent( QMouseEvent* ); void mousePressEvent(QMouseEvent*);
virtual void mouseReleaseEvent( QMouseEvent* ); void mouseReleaseEvent(QMouseEvent*);
virtual void mouseMoveEvent( QMouseEvent* ); void mouseMoveEvent(QMouseEvent*);
virtual void extendSelection( const QPoint& pos ); void extendSelection(const QPoint& pos);
virtual void wheelEvent( QWheelEvent* ); void wheelEvent(QWheelEvent*);
virtual bool focusNextPrevChild( bool next ); bool focusNextPrevChild(bool next);
// drag and drop // drag and drop
virtual void dragEnterEvent(QDragEnterEvent* event); void dragEnterEvent(QDragEnterEvent *event);
virtual void dropEvent(QDropEvent* event); void dropEvent(QDropEvent *event);
void doDrag(); void doDrag();
enum DragState { diNone, diPending, diDragging }; enum DragState { diNone, diPending, diDragging };
@ -768,11 +757,9 @@ private:
// the window onto the terminal screen which this display // the window onto the terminal screen which this display
// is currently showing. // is currently showing.
QPointer<ScreenWindow> _screenWindow; QPointer<ScreenWindow> m_screenWindow;
bool _allowBell;
QGridLayout* _gridLayout; bool m_allowBell;
bool _fixedFont; // has fixed pitch bool _fixedFont; // has fixed pitch
int _fontHeight; // height int _fontHeight; // height
@ -845,7 +832,6 @@ private:
bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted bool _possibleTripleClick; // is set in mouseDoubleClickEvent and deleted
// after QApplication::doubleClickInterval() delay // after QApplication::doubleClickInterval() delay
QLabel *_resizeWidget; QLabel *_resizeWidget;
QTimer *_resizeTimer; QTimer *_resizeTimer;
@ -876,8 +862,7 @@ private:
// color of the character under the cursor is used // color of the character under the cursor is used
QColor _cursorColor; QColor _cursorColor;
MotionAfterPasting m_MotionAfterPasting;
MotionAfterPasting mMotionAfterPasting;
struct InputMethodData struct InputMethodData
{ {
@ -897,7 +882,7 @@ private:
// QMLTermWidget port functions // QMLTermWidget port functions
QFont m_font; QFont m_font;
QPalette m_palette; QPalette m_palette;
QPalette::ColorRole m_color_role; QPalette::ColorRole m_colorRole;
KSession *m_session; KSession *m_session;
bool m_full_cursor_height; bool m_full_cursor_height;
@ -906,8 +891,8 @@ private:
const QPalette palette() { return m_palette; } const QPalette palette() { return m_palette; }
void setPalette(const QPalette &p){ m_palette = p; } void setPalette(const QPalette &p){ m_palette = p; }
QPalette::ColorRole backgroundRole() { return m_color_role; } QPalette::ColorRole backgroundRole() { return m_colorRole; }
void setBackgroundRole(QPalette::ColorRole role) { m_color_role = role; } void setBackgroundRole(QPalette::ColorRole role) { m_colorRole = role; }
void update(const QRegion &region); void update(const QRegion &region);
void update(); void update();
@ -938,20 +923,6 @@ public:
bool fullCursorHeight() const; bool fullCursorHeight() const;
}; };
class AutoScrollHandler : public QObject
{
Q_OBJECT
public:
AutoScrollHandler(QWidget* parent);
protected:
virtual void timerEvent(QTimerEvent* event);
virtual bool eventFilter(QObject* watched,QEvent* event);
private:
QWidget* widget() const { return static_cast<QWidget*>(parent()); }
int _timerId;
};
} }
#endif // TERMINALDISPLAY_H #endif // TERMINALDISPLAY_H

@ -1494,8 +1494,8 @@ char Vt102Emulation::eraseChar() const
{ {
KeyboardTranslator::Entry entry = _keyTranslator->findEntry( KeyboardTranslator::Entry entry = _keyTranslator->findEntry(
Qt::Key_Backspace, Qt::Key_Backspace,
0, Qt::NoModifier,
0); KeyboardTranslator::NoState);
if ( entry.text().count() > 0 ) if ( entry.text().count() > 0 )
return entry.text().at(0); return entry.text().at(0);
else else

@ -404,7 +404,7 @@ int KProcess::startDetached(const QStringList &argv)
int KProcess::pid() const int KProcess::pid() const
{ {
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
return (int) QProcess::pid(); return (int) QProcess::processId();
#else #else
return QProcess::pid() ? QProcess::pid()->dwProcessId : 0; return QProcess::pid() ? QProcess::pid()->dwProcessId : 0;
#endif #endif

@ -331,7 +331,7 @@ gotpty:
!d->chownpty(true)) { !d->chownpty(true)) {
qWarning() qWarning()
<< "chownpty failed for device " << ptyName << "::" << d->ttyName << "chownpty failed for device " << ptyName << "::" << d->ttyName
<< "\nThis means the communication can be eavesdropped." << endl; << "\nThis means the communication can be eavesdropped." << Qt::endl;
} }
#if defined (HAVE__GETPTY) || defined (HAVE_GRANTPT) #if defined (HAVE__GETPTY) || defined (HAVE_GRANTPT)

@ -238,6 +238,10 @@ void KSession::sendText(QString text)
void KSession::sendKey(int rep, int key, int mod) const void KSession::sendKey(int rep, int key, int mod) const
{ {
Q_UNUSED(rep);
Q_UNUSED(key);
Q_UNUSED(mod);
//TODO implement or remove this function. //TODO implement or remove this function.
// Qt::KeyboardModifier kbm = Qt::KeyboardModifier(mod); // Qt::KeyboardModifier kbm = Qt::KeyboardModifier(mod);

Loading…
Cancel
Save