Skip to content

Commit

Permalink
Merge branch 'master' into 'master'
Browse files Browse the repository at this point in the history
Fix most point size warnings on startup

Seems omitting root item size and assuming window will set it wasn't without size effects. Could perhaps even explicitly set size with screen's values, but this already avoids bunch of error output and is a step forward.

Some more polishing included too.

See merge request !8
  • Loading branch information
pvuorela committed May 11, 2016
2 parents 875aa14 + 9a8b61b commit b0a6b65
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 33 deletions.
1 change: 0 additions & 1 deletion main.cpp
Expand Up @@ -154,7 +154,6 @@ int main(int argc, char *argv[])
util.setTerm(&term);
util.setRenderer(tr);

QObject::connect(&term,SIGNAL(displayBufferChanged()),win,SLOT(displayBufferChanged()));
QObject::connect(view.engine(),SIGNAL(quit()),&app,SLOT(quit()));

if (!app.arguments().contains("-nofs")) {
Expand Down
14 changes: 8 additions & 6 deletions qml/Button.qml
Expand Up @@ -21,20 +21,21 @@ import QtQuick 2.0

Rectangle {
id: button
property string text: ""

property string text
property string textColor: "#ffffff"
property bool enabled: true
property bool highlighted: false
signal clicked();
property bool highlighted

// for custom user menu actions
property bool isShellCommand: false
property bool isShellCommand

signal clicked();

color: highlighted ? "#606060" : "#202020"
border.color: "#303030"
border.width: 1
radius: window.radiusSmall
z: 0
clip: true

width: window.buttonWidthLarge
Expand All @@ -60,7 +61,8 @@ Rectangle {
text: button.text
color: button.enabled ? button.textColor : "#606060"
anchors.centerIn: parent
font.pointSize: window.uiFontSize
// avoid warnings on startup by protection against 0 size
font.pointSize: window.uiFontSize > 0 ? window.uiFontSize : 12
}

MouseArea {
Expand Down
4 changes: 0 additions & 4 deletions qml/Key.qml
Expand Up @@ -186,18 +186,14 @@ Rectangle {

Timer {
id: keyRepeatStarter
running: false
repeat: false
interval: 400
triggeredOnStart: false
onTriggered: {
keyRepeatTimer.start();
}
}

Timer {
id: keyRepeatTimer
running: false
repeat: true
triggeredOnStart: true
interval: 80
Expand Down
3 changes: 2 additions & 1 deletion qml/LayoutWindow.qml
Expand Up @@ -21,13 +21,14 @@ import QtQuick 2.0

Rectangle {
id: layoutWindow

property string currentLayout: util.settingsValue("ui/keyboardLayout");
property variant layouts: [""]

width: window.width-1
height: window.height-1
color: "#000000"
z: 100
property variant layouts: [""]
state: ""
y: -(height+1)
border.color: "#c0c0c0"
Expand Down
16 changes: 10 additions & 6 deletions qml/Main.qml
Expand Up @@ -24,6 +24,9 @@ import QtQuick.Window 2.0
Item {
id: root

width: 540
height: 960

property string windowTitle: util.currentWindowTitle();

Item {
Expand Down Expand Up @@ -286,8 +289,6 @@ Item {
objectName: "textrender"
height: parent.height
width: parent.width
myWidth: width
myHeight: height
z: 10

Behavior on opacity {
Expand All @@ -310,8 +311,7 @@ Item {

Timer {
id: fadeTimer
running: false
repeat: false

interval: menu.keyboardFadeOutDelay
onTriggered: {
window.sleepVKB();
Expand All @@ -320,8 +320,7 @@ Item {

Timer {
id: bellTimer
running: false
repeat: false

interval: 80
onTriggered: {
window.color = window.bgcolor;
Expand Down Expand Up @@ -382,6 +381,11 @@ Item {
}
}

Connections {
target: term
onDisplayBufferChanged: window.displayBufferChanged()
}

function vkbKeypress(key,modifiers) {
wakeVKB();
term.keyPress(key,modifiers);
Expand Down
10 changes: 5 additions & 5 deletions textrender.cpp
Expand Up @@ -29,8 +29,8 @@ TextRender::TextRender(QQuickItem *parent) :
{
setFlag(ItemHasContents);

connect(this,SIGNAL(myWidthChanged(int)),this,SLOT(updateTermSize()));
connect(this,SIGNAL(myHeightChanged(int)),this,SLOT(updateTermSize()));
connect(this,SIGNAL(widthChanged()),this,SLOT(updateTermSize()));
connect(this,SIGNAL(heightChanged()),this,SLOT(updateTermSize()));
connect(this,SIGNAL(fontSizeChanged()),this,SLOT(updateTermSize()));

//normal
Expand Down Expand Up @@ -288,8 +288,8 @@ void TextRender::updateTermSize()
if (!iTerm)
return;

QSize s((iWidth-4)/iFontWidth, (iHeight-4)/iFontHeight);
iTerm->setTermSize(s);
QSize size((width() - 4) / iFontWidth, (height() - 4) / iFontHeight);
iTerm->setTermSize(size);
}

void TextRender::setFontPointSize(int psize)
Expand Down Expand Up @@ -321,5 +321,5 @@ QPoint TextRender::charsToPixels(QPoint pos)

QSize TextRender::cursorPixelSize()
{
return (QSize(iFontWidth, iFontHeight));
return QSize(iFontWidth, iFontHeight);
}
10 changes: 0 additions & 10 deletions textrender.h
Expand Up @@ -29,8 +29,6 @@ class Util;

class TextRender : public QQuickPaintedItem
{
Q_PROPERTY(int myWidth READ myWidth WRITE setMyWidth NOTIFY myWidthChanged)
Q_PROPERTY(int myHeight READ myHeight WRITE setMyHeight NOTIFY myHeightChanged)
Q_PROPERTY(int fontWidth READ fontWidth NOTIFY fontSizeChanged)
Q_PROPERTY(int fontHeight READ fontHeight NOTIFY fontSizeChanged)
Q_PROPERTY(int fontPointSize READ fontPointSize WRITE setFontPointSize NOTIFY fontSizeChanged)
Expand All @@ -45,10 +43,6 @@ class TextRender : public QQuickPaintedItem
void setTerminal(Terminal* term);
void setUtil(Util* util) { iUtil = util; }

int myWidth() { return iWidth; }
int myHeight() { return iHeight; }
void setMyWidth(int w) { if(iWidth!=w) { iWidth=w; emit myWidthChanged(w); } }
void setMyHeight(int h) { if(iHeight!=h) { iHeight=h; emit myHeightChanged(h); } }
int fontWidth() { return iFontWidth; }
int fontHeight() { return iFontHeight; }
int fontDescent() { return iFontDescent; }
Expand All @@ -61,8 +55,6 @@ class TextRender : public QQuickPaintedItem
Q_INVOKABLE QSize cursorPixelSize();

signals:
void myWidthChanged(int newWidth);
void myHeightChanged(int newHeight);
void fontSizeChanged();
void showBufferScrollIndicatorChanged();

Expand All @@ -78,8 +70,6 @@ public slots:
void drawTextFragment(QPainter* painter, int x, int y, QString text, TermChar style);
QPoint charsToPixels(QPoint pos);

int iWidth;
int iHeight;
QFont iFont;
int iFontWidth;
int iFontHeight;
Expand Down
1 change: 1 addition & 0 deletions util.cpp
Expand Up @@ -40,6 +40,7 @@ Util::Util(QSettings *settings, QObject *parent) :
newSelection(true),
iSettings(settings),
iWindow(0),
iTerm(0),
iRenderer(0)
{
connect(QGuiApplication::clipboard(), SIGNAL(dataChanged()), this, SIGNAL(clipboardOrSelectionChanged()));
Expand Down

0 comments on commit b0a6b65

Please sign in to comment.