-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a9a6b3b
Showing
11 changed files
with
916 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
*.user | ||
*.user.* | ||
*.aps | ||
build-*/ | ||
*.*-pre1 | ||
*.autosave | ||
*.*~ | ||
*.uxf | ||
Thumbs.db | ||
ehthumbs.db | ||
Desktop.ini |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# TTKCalendar | ||
 | ||
 | ||
 | ||
|
||
### **|[About](https://github.com/TTKProject/TTKCalendar#usage)|[License](https://github.com/TTKProject/TTKCalendar#license)|[Screenshots](https://github.com/TTKProject/TTKCalendar#screenshots)|[Copyright](https://github.com/TTKProject/TTKCalendar#copyright)|[Contribute](https://github.com/TTKProject/TTKCalendar#how-to-contribute)|** | ||
|
||
Usage | ||
---- | ||
* Qt develop version be tested on Qt4.8.7 for windows-mingw 32bit | ||
* Qt develop version be tested on Qt4.8.6 for ubuntu-linux-gcc 64bit | ||
* Qt develop version be tested on Qt5.x for windows-mingw 32bit | ||
* Qt develop version be tested on Qt5.x for ubuntu-linux-gcc 64bit | ||
* Qt develop version be tested on Qt5.x for windows-msvc | ||
|
||
| Platform | Qt & Compiler | Status | | ||
| :---: | :---: | :---: | | ||
| Linux | 4.8.7 GCC & 5.x GCC |  | | ||
| Windows | 4.8.7 GCC & 5.x GCC |  | | ||
| Windows | 5.x MSVC |  | | ||
| OS X | 5.x Clang |  | | ||
|
||
# For Developers | ||
|
||
License | ||
--- | ||
TTKCalendar is free software licensed under the term of [Licence GPL v3](https://github.com/TTKProject/TTKCalendar/blob/master/LICENSE). If you use TTKCalendar or its constituent libraries, you must add here to the terms of the license in question. | ||
|
||
Screenshots | ||
---- | ||
### Demo | ||
 | ||
|
||
Copyright | ||
------- | ||
* This file is part of the TTKCalendar project. | ||
* Copyright (c) 2017 - 2020 Greedysky Studio. | ||
* mail: [email protected]. | ||
|
||
How To Contribute | ||
------- | ||
* Fork this project on github and make a branch. Commit in that branch, and push, then create a pull request to be reviewed and merged. | ||
* Create an issue if you have any problem when using project or you find a bug, etc. | ||
* What you can do: translation, write document, wiki, find or fix bugs, give your idea for this project etc. | ||
* If you want to join the project developed together, please send e-mail to me. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# ================================================= | ||
# * This file is part of the TTKCalendar project | ||
# * Copyright (C) 2017 - 2020 Greedysky Studio | ||
# | ||
# * This program is free software; you can redistribute it and/or modify | ||
# * it under the terms of the GNU General Public License as published by | ||
# * the Free Software Foundation; either version 3 of the License, or | ||
# * (at your option) any later version. | ||
# | ||
# * This program is distributed in the hope that it will be useful, | ||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# * GNU General Public License for more details. | ||
# | ||
# * You should have received a copy of the GNU General Public License along | ||
# * with this program; If not, see <http://www.gnu.org/licenses/>. | ||
# ================================================= | ||
|
||
QT += core gui | ||
|
||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets | ||
|
||
TARGET = TTKCalendar | ||
TEMPLATE = app | ||
|
||
msvc{ | ||
CONFIG +=c++11 | ||
}else{ | ||
QMAKE_CXXFLAGS += -std=c++11 | ||
} | ||
|
||
SOURCES += \ | ||
main.cpp \ | ||
ttkapplication.cpp | ||
|
||
HEADERS += \ | ||
ttkapplication.h | ||
|
||
RESOURCES += \ | ||
TTKCalendar.qrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<RCC> | ||
<qresource prefix="/data"> | ||
<file>images/flag-cn.ico</file> | ||
<file>images/today.ico</file> | ||
</qresource> | ||
</RCC> |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "ttkapplication.h" | ||
#include <QApplication> | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
QApplication a(argc, argv); | ||
TTKApplication w; | ||
w.show(); | ||
|
||
return a.exec(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#include "ttkapplication.h" | ||
|
||
TTKButton::TTKButton(QWidget *parent) | ||
: QToolButton(parent) | ||
{ | ||
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); | ||
setToolButtonStyle(Qt::ToolButtonIconOnly); | ||
setAutoRaise(true); | ||
} | ||
|
||
QSize TTKButton::sizeHint() const | ||
{ | ||
QSize size = QToolButton::sizeHint(); | ||
size.rheight() += 6; | ||
return size; | ||
} | ||
|
||
|
||
TTKApplication::TTKApplication(QWidget *parent) | ||
: QWidget(parent) | ||
{ | ||
createPreviewGroupBox(); | ||
setWindowTitle(tr("TTKApplication")); | ||
|
||
QGridLayout* layout = new QGridLayout(this); | ||
layout->addWidget(m_groupBox, 0, 0); | ||
layout->setSizeConstraint(QLayout::SetFixedSize); | ||
|
||
m_layout->setRowMinimumHeight(0, m_calendar->sizeHint().height()); | ||
m_layout->setColumnMinimumWidth(0, m_calendar->sizeHint().width()); | ||
m_today = QDate(m_calendar->selectedDate()); | ||
|
||
setLayout(layout); | ||
} | ||
|
||
void TTKApplication::today() | ||
{ | ||
m_calendar->setSelectedDate(m_today); | ||
} | ||
|
||
void TTKApplication::createPreviewGroupBox() | ||
{ | ||
m_groupBox = new QGroupBox(tr("Calendar"), this); | ||
m_calendar = new QCalendarWidget(this); | ||
m_calendar->setMinimumDate(QDate(1900, 1, 1)); | ||
m_calendar->setMaximumDate(QDate(3000, 1, 1)); | ||
m_calendar->setGridVisible(true); | ||
|
||
m_todayButton = new TTKButton(this); | ||
m_todayButton->setIcon(QIcon(":/data/images/today.ico")); | ||
m_todayButton->setToolTip(tr("Today")); | ||
connect(m_todayButton, SIGNAL(clicked()), SLOT(today())); | ||
|
||
m_timeZoneButton = new TTKButton(this); | ||
m_timeZoneButton->setIcon(QIcon(":/data/images/flag-cn.ico")); | ||
|
||
m_layout = new QGridLayout; | ||
m_layout->addWidget(m_calendar, 0, 0, Qt::AlignCenter); | ||
|
||
QHBoxLayout* showLayout = new QHBoxLayout; | ||
showLayout->addWidget(m_timeZoneButton); | ||
showLayout->addStretch(); | ||
showLayout->addWidget(m_todayButton); | ||
|
||
QVBoxLayout* mainLayout = new QVBoxLayout; | ||
mainLayout->addLayout(m_layout); | ||
mainLayout->addLayout(showLayout); | ||
m_groupBox->setLayout(mainLayout); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#ifndef TTKAPPLICATION_H | ||
#define TTKAPPLICATION_H | ||
|
||
/* ================================================= | ||
* This file is part of the TTKCalendar project | ||
* Copyright (C) 2017 - 2020 Greedysky Studio | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 3 of the License, or | ||
* (at your option) any later version. | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; If not, see <http://www.gnu.org/licenses/>. | ||
================================================= */ | ||
|
||
#include <QGroupBox> | ||
#include <QGridLayout> | ||
#include <QToolButton> | ||
#include <QCalendarWidget> | ||
|
||
class TTKButton : public QToolButton | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit TTKButton(QWidget *parent = nullptr); | ||
|
||
protected: | ||
virtual QSize sizeHint() const override; | ||
}; | ||
|
||
|
||
class TTKApplication : public QWidget | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit TTKApplication(QWidget *parent = nullptr); | ||
|
||
protected Q_SLOTS: | ||
void today(); | ||
|
||
protected: | ||
void createPreviewGroupBox(); | ||
|
||
QGroupBox *m_groupBox; | ||
QGridLayout *m_layout; | ||
QCalendarWidget *m_calendar; | ||
|
||
QDate m_today; | ||
TTKButton *m_timeZoneButton; | ||
TTKButton *m_todayButton; | ||
|
||
}; | ||
|
||
#endif |