Skip to content

Commit

Permalink
Going back to Qt 4.6.2 and removing requirement for c++11
Browse files Browse the repository at this point in the history
(allows yata to be compiled on centos)
  • Loading branch information
sarajames committed Apr 5, 2014
1 parent 04a830a commit 8f29fa7
Show file tree
Hide file tree
Showing 12 changed files with 32 additions and 23 deletions.
1 change: 1 addition & 0 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <QApplication>
#include <QDir>
#include <QScopedPointer>
#include <QIcon>
#include "MainWindow.h"
#include "SessionLoader.h"
#include "YApplication.h"
Expand Down
3 changes: 2 additions & 1 deletion document/YTextDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ YFileCursor YTextDocument::yFileCursor(int docPos) const
cursor.setPosition(docPos);
QTextBlock block = cursor.block();
qint64 linePos = m_lineAddresses.at(block.blockNumber());
return YFileCursor(linePos, cursor.positionInBlock());
int positionInBlock = cursor.position() - cursor.block().position();
return YFileCursor(linePos, positionInBlock);
}

void YTextDocument::startSelect(const QPoint & point)
Expand Down
2 changes: 1 addition & 1 deletion gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MainWindow::MainWindow(): ui(new Ui::MainWindow())
ui->actionAboutYata->setText(aboutYataText);

connect(m_tabWidget.data(), SIGNAL(currentTabChanged(int,int)), SLOT(onCurrentTabChanged(int,int)));
connect(m_tabWidget.data(), &YTabWidget::currentFileDisplayChanged, this, &MainWindow::updateWindowTitle);
connect(m_tabWidget.data(), SIGNAL(currentFileDisplayChanged()), SLOT(updateWindowTitle()));

ui->menuFile->insertActions(ui->actionExit, m_tabWidget->contextMenu()->actions());
ui->menuFile->insertSeparator(ui->actionExit);
Expand Down
2 changes: 1 addition & 1 deletion gui/YStatusBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ YStatusBar::~YStatusBar()
void YStatusBar::errorMessage(const QString & msg)
{
QString format = QString("<p style=\"background-color:yellow\">") %
msg.toHtmlEscaped() % "</p>";
Qt::escape(msg) % "</p>";
m_leftLabel->setText(format);
}

Expand Down
4 changes: 2 additions & 2 deletions gui/YTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ YTabWidget::YTabWidget(QWidget *parent)

connect(this, SIGNAL(tabCloseRequested(int)), SLOT(on_tabCloseRequested(int)));
connect(tabBar(), SIGNAL(tabMoved(int,int)), SLOT(onTabMoved(int,int)));
connect(this, &QTabWidget::currentChanged, this, &YTabWidget::on_currentTabChanged);
connect(this, SIGNAL(currentChanged(int)), SLOT(on_currentTabChanged(int)));

m_actionCloseTab.reset(m_menuTab->addAction(
tr("&Close tab"),
Expand Down Expand Up @@ -93,7 +93,7 @@ void YTabWidget::openTab(TailView * child)
int index = addTab(child, shortName);
child->setFocus();
setTabToolTip(index, fullName);
connect(child, &TailView::fileChanged, this, &YTabWidget::onFileChanged);
connect(child, SIGNAL(fileChanged()), SLOT(onFileChanged()));

QAction * action = new QAction(fullName, this);
action->setCheckable(true);
Expand Down
6 changes: 6 additions & 0 deletions view/ApproximateScrollBarController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@

const qint64 APPROXIMATE_CHARS_PER_LINE = 20;

ApproximateScrollBarController::ApproximateScrollBarController(TailView * view):
ScrollBarStrategy(view),
m_lastSBPosition(-1)
{
}

void ApproximateScrollBarController::onFileChanged()
{
}
Expand Down
8 changes: 4 additions & 4 deletions view/ApproximateScrollBarController.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

class ApproximateScrollBarController : public ScrollBarStrategy {
public:
using ScrollBarStrategy::ScrollBarStrategy;
ApproximateScrollBarController(TailView * view);

void onFileChanged() override;
ScreenPosition position() override;
void onFileChanged();
ScreenPosition position();
private:
int m_lastSBPosition = -1;
int m_lastSBPosition;
ScreenPosition m_currentScreenPos;
};

Expand Down
4 changes: 2 additions & 2 deletions view/ExactScrollBarController.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class ExactScrollBarController : public ScrollBarStrategy
public:
ExactScrollBarController(TailView *tailView);

void onFileChanged() override;
ScreenPosition position() override;
void onFileChanged();
ScreenPosition position();
private:
QScopedPointer<YTextDocument> m_document;
};
Expand Down
4 changes: 2 additions & 2 deletions view/ScreenPosition.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#include <QtGlobal>

struct ScreenPosition {
qint64 address = 0;
int blockLine = 0;
qint64 address;
int blockLine;

ScreenPosition(qint64 a=0, int bl=0);
bool operator==(const ScreenPosition & other) const;
Expand Down
1 change: 1 addition & 0 deletions view/TailView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <QPainter>
#include <QScrollBar>
#include <QStringBuilder>
#include <QTextCursor>
#include <QTextLayout>
#include <QTextStream>
#include <QtDebug>
Expand Down
16 changes: 8 additions & 8 deletions view/TailView.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ public slots:
void onSelectAll();

protected:
void mousePressEvent(QMouseEvent * event) override;
void mouseReleaseEvent(QMouseEvent * event) override;
void mouseMoveEvent(QMouseEvent * event) override;
void mouseDoubleClickEvent(QMouseEvent * event) override;
void paintEvent(QPaintEvent * event) override;
void resizeEvent(QResizeEvent *) override;
void keyPressEvent(QKeyEvent * event) override;
void wheelEvent(QWheelEvent * event) override;
void mousePressEvent(QMouseEvent * event);
void mouseReleaseEvent(QMouseEvent * event);
void mouseMoveEvent(QMouseEvent * event);
void mouseDoubleClickEvent(QMouseEvent * event);
void paintEvent(QPaintEvent * event);
void resizeEvent(QResizeEvent *);
void keyPressEvent(QKeyEvent * event);
void wheelEvent(QWheelEvent * event);

private slots:
void vScrollBarAction(int action);
Expand Down
4 changes: 2 additions & 2 deletions yata.pro
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DEFINES += 'APPVERSION=\\"$$VERSION\\"'

TEMPLATE = app
CONFIG += debug_and_release warn_on
QMAKE_CXXFLAGS += -std=c++11 -pedantic
QMAKE_CXXFLAGS += -pedantic
build_pass:CONFIG(release, debug|release) {
TARGET = yata
} else {
Expand Down Expand Up @@ -107,7 +107,7 @@ SOURCES += \
RESOURCES += \
resource/resources.qrc

QT += widgets
#QT += widgets

win32 {
isEmpty(YAMLCPP): YAMLCPP = $$PWD/../yaml-cpp
Expand Down

0 comments on commit 8f29fa7

Please sign in to comment.