Skip to content

Commit

Permalink
Merge pull request #15 from SatoshiShimada/dev
Browse files Browse the repository at this point in the history
New layout
  • Loading branch information
SatoshiShimada authored Feb 24, 2019
2 parents bcf00fa + e1f7a0e commit c23fe64
Show file tree
Hide file tree
Showing 22 changed files with 1,511 additions and 720 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ matrix:
osx_image: xcode9.2
compiler: clang
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update -all; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew link --force qt; fi
script: ./qt_make.sh
Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@

# Game Monitor

![Screen Image](https://github.com/SatoshiShimada/game_monitor/wiki/figures/screen_image.png)
![Screen Image](https://github.com/SatoshiShimada/game_monitor/wiki/figures/screen_image3.png)

The robot state viewer via robot communication.
It is for CIT Brains' robot "Accelite".
It is for CIT Brains' robot "Accelite" and "GankenKun".
This application supports Linux, Mac OS and Windows.
If you find a bug please let me know by opening an issue in this repository.
Please check Wiki for more information.

Functions:

- Display
- Game state (from official GameController)
- Game time
- Secondary time (kick-off, time-out, etc.)
- Score
- Robot state (from robot communication)
- Robot position and reliability
- Current strategy
- Detected ball position and reliability
- Detected goal post positions
- Voltage of the motor
- Temperature of the motor
- Logging and play the status of the game.

## Requirements

* [Qt](https://www.qt.io/) (Version: 5.3 or greater)
* gcc (only Linux)
* XCode (only Mac OS)(Version: 9 or greater)
* Visual Studio (only Windows)

## How to build

Expand All @@ -24,6 +37,7 @@ Please check Wiki for more information.
1. Install libraries.

```shell
git checkout ubuntu14.04
apt install build-essential
```

Expand Down Expand Up @@ -65,7 +79,8 @@ apt install qt5-default qtmultimedia5-dev

```
brew update -all
brew install qt
brew install qt5
export PATH="/usr/local/Cellar/qt/5.12.0/bin:$PATH"
```

2. Build application.
Expand Down
Binary file removed figures/citbrains_logo.png
Binary file not shown.
Binary file removed figures/hlfield.png
Binary file not shown.
41 changes: 41 additions & 0 deletions src/aspect_ratio_pixmap_label.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "aspect_ratio_pixmap_label.h"

AspectRatioPixmapLabel::AspectRatioPixmapLabel(QWidget *parent) : QLabel(parent)
{
constexpr int minimum_width = 740;
constexpr int minimum_height = 540;
this->setMinimumSize(minimum_width, minimum_height);
setScaledContents(false);
}

void AspectRatioPixmapLabel::setPixmap(const QPixmap &p)
{
pix = p;
QLabel::setPixmap(scaledPixmap());
}

int AspectRatioPixmapLabel::heightForWidth(int width) const
{
if(this->height())
return pix.isNull();
else
return (static_cast<qreal>(pix.height()) * width) / pix.width();
}

QSize AspectRatioPixmapLabel::sizeHint() const
{
int w = this->width();
return QSize(w, heightForWidth(w));
}

QPixmap AspectRatioPixmapLabel::scaledPixmap() const
{
return pix.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
}

void AspectRatioPixmapLabel::resizeEvent(QResizeEvent *e)
{
if(!pix.isNull())
QLabel::setPixmap(scaledPixmap());
}

27 changes: 27 additions & 0 deletions src/aspect_ratio_pixmap_label.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#ifndef ASPECT_RATIO_PIXMAP_LABEL_H
#define ASPECT_RATIO_PIXMAP_LABEL_H

#include <QtGui>
#include <QtCore>
#include <QApplication>
#include <QLabel>
#include <QPixmap>
#include <QResizeEvent>

class AspectRatioPixmapLabel : public QLabel
{
Q_OBJECT
public:
AspectRatioPixmapLabel(QWidget *parent = 0);
virtual int heightForWidth(int width) const;
virtual QSize sizeHint() const;
QPixmap scaledPixmap() const;
public slots:
void setPixmap(const QPixmap &);
void resizeEvent(QResizeEvent *);
private:
QPixmap pix;
};

#endif // ASPECT_RATIO_PIXMAP_LABEL_H

131 changes: 0 additions & 131 deletions src/capture.cpp

This file was deleted.

55 changes: 0 additions & 55 deletions src/capture.h

This file was deleted.

Loading

0 comments on commit c23fe64

Please sign in to comment.