Skip to content
Permalink
Browse files

Program upload

  • Loading branch information...
postman721 committed Sep 30, 2018
1 parent f61c8c7 commit 9cf8e59ff31634251422333bfff1cf7adb99ffdf
Showing with 614 additions and 0 deletions.
  1. BIN clock.jpg
  2. +31 −0 clocktime.pro
  3. +7 −0 copyright
  4. +12 −0 executable/README.md
  5. BIN executable/clocktime
  6. +17 −0 main.cpp
  7. +38 −0 mainwindow.cpp
  8. +31 −0 mainwindow.h
  9. +478 −0 mainwindow.ui
BIN +129 KB clock.jpg
Binary file not shown.
@@ -0,0 +1,31 @@
#-------------------------------------------------
#
# Project created by QtCreator 2018-09-30T12:22:59
#
#-------------------------------------------------
QT += core gui widgets

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = clocktime
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0


SOURCES += main.cpp\
mainwindow.cpp

HEADERS += \
mainwindow.h

FORMS += mainwindow.ui
@@ -0,0 +1,7 @@
/*
#Digital Clock v.3 Copyright (c) 2018 JJ Posti <techtimejourney.net>
#Digital Clock comes with ABSOLUTELY NO WARRANTY;
#for details see: http://www.gnu.org/copyleft/gpl.html.
#This is free software, and you are welcome to redistribute it under
#GPL Version 2, June 1991
*/
@@ -0,0 +1,12 @@
The executable can be run as follows:

cd into the folder that has it and:
./clocktime

Alternatively, place it anywhere you want and create a symbolic link to /usr/bin.

Example:

sudo ln -s /home/user/Digital_clock3/Release/executable/clocktime /usr/bin/clocktime

Now the command clocktime should open the clock.
BIN +467 KB executable/clocktime
Binary file not shown.
@@ -0,0 +1,17 @@
#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;

//Center the window.
QSize size = qApp->desktop()->availableGeometry().size();
int width=size.width()/2-w.width()/2;
int height=size.height()/2-w.height()/2;
w.move(width, height);
w.show();

return a.exec();
}
@@ -0,0 +1,38 @@
/*
#Digital Clock v.3 Copyright (c) 2018 JJ Posti <techtimejourney.net>
#Digital Clock comes with ABSOLUTELY NO WARRANTY;
#for details see: http://www.gnu.org/copyleft/gpl.html.
#This is free software, and you are welcome to redistribute it under
#GPL Version 2, June 1991
*/

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);

//Make frameless window.
MainWindow::setWindowFlags(Qt::FramelessWindowHint);

//Setup timer that watches the clock and updates it.
timer=new QTimer(this);
connect(timer,SIGNAL(timeout()),this,SLOT(showTime()));
timer->start();
}

//The actual timer function.
void MainWindow::showTime(){

QTime time = QTime::currentTime();
QString text = time.toString("hh: mm");
ui->time->setText(text);
}

MainWindow::~MainWindow()
{
delete ui;
}
@@ -0,0 +1,31 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDateTime>
#include <QTimer>
#include <QDesktopWidget>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();

private slots:
void showTime();


private:
Ui::MainWindow *ui;
QTimer *timer;
};

#endif // MAINWINDOW_H

0 comments on commit 9cf8e59

Please sign in to comment.
You can’t perform that action at this time.