├── .gitignore
├── Ameba.pro
├── Android
├── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle.properties~
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── local.properties
├── local.properties~
└── res
│ ├── drawable-hdpi
│ └── icon.png
│ ├── drawable-ldpi
│ └── icon.png
│ ├── drawable-mdpi
│ └── icon.png
│ └── values
│ └── libs.xml
├── Images
├── Icon.png
├── LeftHandle.png
├── Logo.png
└── RightHandle.png
├── LICENSE.txt
├── README.md
├── Source
├── AmebaApp.cpp
├── AmebaApp.h
├── MainWindow.cpp
├── MainWindow.h
├── TextEditor.cpp
├── TextEditor.h
└── main.cpp
├── ameba.qrc
└── style.css
/.gitignore:
--------------------------------------------------------------------------------
1 | *.user
2 | Build
--------------------------------------------------------------------------------
/Ameba.pro:
--------------------------------------------------------------------------------
1 |
2 | # DEFINES
3 |
4 | win32|win64:CONFIG += win
5 | unix:!macx:!android:CONFIG += linux
6 | macx:CONFIG += osx
7 | android:CONFIG += android
8 |
9 | win:DEFINES += WIN
10 | linux:DEFINES += LINUX
11 | osx:DEFINES += OSX
12 | android:DEFINES += ANDROID
13 |
14 | # PROJECT
15 |
16 | TEMPLATE = app
17 |
18 | CONFIG += qt c++11
19 | CONFIG -= debug_and_release debug_and_release_target
20 | QT += widgets
21 |
22 | HEADERS += $$files(Source/*.h, true)
23 | SOURCES += $$files(Source/*.cpp, true)
24 | INCLUDEPATH += Source
25 |
26 | RESOURCES = ameba.qrc
27 |
28 | # OPTIONS
29 |
30 | win|osx {
31 | QMAKE_CXXFLAGS += /wd4250 /wd4800 /wd5030
32 | }
33 |
34 | linux|android {
35 | QMAKE_CXXFLAGS += -std=c++0x -fpermissive -Wno-attribute
36 | }
37 |
38 | DISTFILES += \
39 | Android/AndroidManifest.xml \
40 | Android/gradle/wrapper/gradle-wrapper.jar \
41 | Android/gradlew \
42 | Android/res/values/libs.xml \
43 | Android/build.gradle \
44 | Android/gradle/wrapper/gradle-wrapper.properties \
45 | Android/gradlew.bat
46 |
47 | ANDROID_PACKAGE_SOURCE_DIR = $$PWD/Android
48 |
--------------------------------------------------------------------------------
/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
73 |
74 |
75 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/Android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | }
5 |
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:2.2.3'
8 | }
9 | }
10 |
11 | allprojects {
12 | repositories {
13 | jcenter()
14 | }
15 | }
16 |
17 | apply plugin: 'com.android.application'
18 |
19 | dependencies {
20 | compile fileTree(dir: 'libs', include: ['*.jar'])
21 | }
22 |
23 | android {
24 | /*******************************************************
25 | * The following variables:
26 | * - androidBuildToolsVersion,
27 | * - androidCompileSdkVersion
28 | * - qt5AndroidDir - holds the path to qt android files
29 | * needed to build any Qt application
30 | * on Android.
31 | *
32 | * are defined in gradle.properties file. This file is
33 | * updated by QtCreator and androiddeployqt tools.
34 | * Changing them manually might break the compilation!
35 | *******************************************************/
36 |
37 | compileSdkVersion androidCompileSdkVersion.toInteger()
38 |
39 | buildToolsVersion androidBuildToolsVersion
40 |
41 | sourceSets {
42 | main {
43 | manifest.srcFile 'AndroidManifest.xml'
44 | java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java']
45 | aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl']
46 | res.srcDirs = [qt5AndroidDir + '/res', 'res']
47 | resources.srcDirs = ['src']
48 | renderscript.srcDirs = ['src']
49 | assets.srcDirs = ['assets']
50 | jniLibs.srcDirs = ['libs']
51 | }
52 | }
53 |
54 | lintOptions {
55 | abortOnError false
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/Android/gradle.properties:
--------------------------------------------------------------------------------
1 | ## This file is automatically generated by QtCreator.
2 | #
3 | # This file must *NOT* be checked into Version Control Systems,
4 | # as it contains information specific to your local configuration.
5 |
6 | androidBuildToolsVersion=28.0.1
7 | androidCompileSdkVersion=28
8 | buildDir=.build
9 | qt5AndroidDir=C:/Qt/5.11.0/android_armv7/src/android/java
10 |
--------------------------------------------------------------------------------
/Android/gradle.properties~:
--------------------------------------------------------------------------------
1 | ## This file is automatically generated by QtCreator.
2 | #
3 | # This file must *NOT* be checked into Version Control Systems,
4 | # as it contains information specific to your local configuration.
5 |
6 | androidBuildToolsVersion=28.0.1
7 | androidCompileSdkVersion=28
8 | buildDir=.build
9 | qt5AndroidDir=C:/Qt/5.11.0/android_armv7/src/android/java
10 |
--------------------------------------------------------------------------------
/Android/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alprog/Ameba/741e72480e3914ee0e0e8e1ea3d291cd92bd8fa7/Android/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/Android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Feb 20 10:43:22 EST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip
7 |
--------------------------------------------------------------------------------
/Android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS="-Xmx1024m -Dfile.encoding=UTF-8"
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn ( ) {
37 | echo "$*"
38 | }
39 |
40 | die ( ) {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save ( ) {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/Android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=-Xmx1024m -Dfile.encoding=UTF-8
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/Android/local.properties:
--------------------------------------------------------------------------------
1 | ## This file is automatically generated by QtCreator.
2 | #
3 | # This file must *NOT* be checked into Version Control Systems,
4 | # as it contains information specific to your local configuration.
5 |
6 | sdk.dir=C:/Users/alpro/AppData/Local/Android/Sdk
7 |
--------------------------------------------------------------------------------
/Android/local.properties~:
--------------------------------------------------------------------------------
1 | ## This file is automatically generated by QtCreator.
2 | #
3 | # This file must *NOT* be checked into Version Control Systems,
4 | # as it contains information specific to your local configuration.
5 |
6 | sdk.dir=C:/Users/alpro/AppData/Local/Android/Sdk
7 |
--------------------------------------------------------------------------------
/Android/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alprog/Ameba/741e72480e3914ee0e0e8e1ea3d291cd92bd8fa7/Android/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/Android/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alprog/Ameba/741e72480e3914ee0e0e8e1ea3d291cd92bd8fa7/Android/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/Android/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alprog/Ameba/741e72480e3914ee0e0e8e1ea3d291cd92bd8fa7/Android/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/Android/res/values/libs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - https://download.qt.io/ministro/android/qt5/qt-5.9
5 |
6 |
7 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Images/Icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alprog/Ameba/741e72480e3914ee0e0e8e1ea3d291cd92bd8fa7/Images/Icon.png
--------------------------------------------------------------------------------
/Images/LeftHandle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alprog/Ameba/741e72480e3914ee0e0e8e1ea3d291cd92bd8fa7/Images/LeftHandle.png
--------------------------------------------------------------------------------
/Images/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alprog/Ameba/741e72480e3914ee0e0e8e1ea3d291cd92bd8fa7/Images/Logo.png
--------------------------------------------------------------------------------
/Images/RightHandle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alprog/Ameba/741e72480e3914ee0e0e8e1ea3d291cd92bd8fa7/Images/RightHandle.png
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2018 Alexander Tuzhik
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Ameba (aggregate message bar)
2 |
3 | 
4 |
5 | Aggregate message bar for different instant messangers.
--------------------------------------------------------------------------------
/Source/AmebaApp.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "AmebaApp.h"
3 | #include
4 | #include
5 | #include "MainWindow.h"
6 |
7 | AmebaApp::AmebaApp(int argc, char** argv):
8 | QApplication(argc, argv)
9 | {
10 | if (fileno(stdout) <= 0)
11 | {
12 | freopen("log.txt", "w", stdout);
13 | }
14 |
15 | loadStyle();
16 | loadSettings();
17 | start();
18 | }
19 |
20 | AmebaApp* AmebaApp::getInstance()
21 | {
22 | return static_cast(QApplication::instance());
23 | }
24 |
25 | void AmebaApp::loadStyle()
26 | {
27 | QFile file("style.css");
28 | if (file.open(QIODevice::ReadOnly | QIODevice::Text))
29 | {
30 | QTextStream stream(&file);
31 | QString sheet = stream.readAll();
32 | setStyleSheet(sheet);
33 | }
34 | file.close();
35 | }
36 |
37 | void AmebaApp::loadSettings()
38 | {
39 | /*auto fileName = getSettingsFilename();
40 | QFile file(QString::fromStdString(fileName));
41 | if (file.open(QIODevice::ReadOnly | QIODevice::Text))
42 | {
43 | QTextStream stream(&file);
44 | auto text = stream.readAll().toStdString();
45 | settings = serializer.deserialize(text);
46 | file.close();
47 | }*/
48 | }
49 |
50 | void AmebaApp::saveSettings()
51 | {
52 | /*auto fileName = getSettingsFilename();
53 | QFile file(QString::fromStdString(fileName));
54 | file.open(QIODevice::WriteOnly);
55 | QTextStream stream(&file);
56 | auto text = serializer.serialize(settings);
57 | stream << tr(text.c_str());
58 | file.close();*/
59 | }
60 |
61 | void AmebaApp::start()
62 | {
63 | auto mainWindow = new MainWindow();
64 | mainWindow->resize(800, 600);
65 | mainWindow->show();
66 | windows.push_back(mainWindow);
67 | }
68 |
69 | MainWindow* AmebaApp::getMainWindow()
70 | {
71 | return windows[0];
72 | }
73 |
--------------------------------------------------------------------------------
/Source/AmebaApp.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 |
4 | #include
5 | #include
6 | #include
7 | #include "MainWindow.h"
8 |
9 | class AmebaApp : public QApplication
10 | {
11 | Q_OBJECT
12 |
13 | friend int main(int argc, char *argv[]);
14 |
15 | AmebaApp(int argc, char** argv);
16 |
17 | public:
18 | static AmebaApp* getInstance();
19 | void saveSettings();
20 | MainWindow* getMainWindow();
21 |
22 | private:
23 | void start();
24 | void loadStyle();
25 | void loadSettings();
26 |
27 | private:
28 | std::vector windows;
29 | };
30 |
--------------------------------------------------------------------------------
/Source/MainWindow.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include "MainWindow.h"
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 |
13 | MainWindow::MainWindow(QWidget* parent)
14 | : QMainWindow(parent)
15 | {
16 | setWindowTitle("Ameba");
17 | setWindowIcon(QIcon(":/Images/Icon.png"));
18 | setWindowOpacity(1);
19 |
20 |
21 | auto layout = new QVBoxLayout();
22 | {
23 | layout->setMargin(0);
24 |
25 | auto hLayout = new QHBoxLayout();
26 | {
27 | hLayout->setMargin(0);
28 |
29 | button = new QPushButton("Button");
30 |
31 | button->setIcon(QIcon());
32 | button->setMaximumSize(300, 130);
33 | hLayout->addWidget(button);
34 | connect(button, SIGNAL(clicked()), this, SLOT(onButtonClicked()));
35 |
36 | hLayout->addWidget(new QWidget);
37 | }
38 | layout->addLayout(hLayout);
39 |
40 | textEditor = new TextEditor(nullptr);
41 | layout->addWidget(textEditor);
42 | }
43 |
44 | button->setFocusProxy(textEditor);
45 |
46 | auto widget = new QWidget();
47 | widget->setLayout(layout);
48 | setCentralWidget(widget);
49 | }
50 |
51 | MainWindow::~MainWindow()
52 | {
53 | }
54 |
55 | void MainWindow::onButtonClicked()
56 | {
57 | printf("%i\n", textEditor->textCursor().position());
58 |
59 | QTextCursor cursor(textEditor->textCursor());
60 | cursor.select(QTextCursor::WordUnderCursor);
61 | textEditor->setTextCursor(cursor);
62 | textEditor->viewport()->repaint();
63 | }
64 |
--------------------------------------------------------------------------------
/Source/MainWindow.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 | #include
4 | #include
5 | #include
6 |
7 | class MainWindow : public QMainWindow
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | explicit MainWindow(QWidget* parent = 0);
13 | ~MainWindow();
14 |
15 | private slots:
16 | void onButtonClicked();
17 |
18 | private:
19 | TextEditor* textEditor;
20 | QPushButton* button;
21 | };
22 |
--------------------------------------------------------------------------------
/Source/TextEditor.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | TextEditor::TextEditor(QWidget *parent):
9 | QTextEdit(parent)
10 | {
11 | connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged()));
12 | }
13 |
14 | TextEditor::~TextEditor()
15 | {
16 | }
17 |
18 | bool TextEditor::event(QEvent *e)
19 | {
20 | if (e->type() == QEvent::Paint)
21 | {
22 | auto r = ((QPaintEvent*)e)->rect();
23 | printf("%i %i %i %i\n", r.left(), r.top(), r.right(), r.bottom());
24 | fflush(stdout);
25 | }
26 | else if (e->type() == QEvent::FocusIn)
27 | {
28 | focusInEvent((QFocusEvent*)e);
29 | return true;
30 | }
31 | return QTextEdit::event(e);
32 | }
33 |
34 | void TextEditor::inputMethodEvent(QInputMethodEvent* e)
35 | {
36 | QTextEdit::inputMethodEvent(e);
37 | }
38 |
39 | void TextEditor::focusInEvent(QFocusEvent* e)
40 | {
41 | QTextEdit::focusInEvent(e);
42 | }
43 |
44 | void TextEditor::paintEvent(QPaintEvent* e)
45 | {
46 | const int iconSize = 32;
47 |
48 | QTextEdit::paintEvent(e);
49 |
50 | auto textCursor = this->textCursor();
51 | auto selectionDelta = textCursor.position() - textCursor.anchor();
52 | if (selectionDelta == 0)
53 | {
54 | return;
55 | }
56 |
57 | auto anchorCursor = textCursor;
58 | anchorCursor.setPosition(textCursor.anchor());
59 |
60 | auto inverted = selectionDelta < 0;
61 |
62 | auto leftHandleRect = cursorRect(inverted ? textCursor : anchorCursor);
63 | auto rightHandleRect = cursorRect(inverted ? anchorCursor : textCursor);
64 |
65 | QPixmap leftIcon(":/Images/LeftHandle.png");
66 | QPixmap rightIcon(":/Images/RightHandle.png");
67 | QPainter painter(viewport());
68 | painter.drawPixmap(leftHandleRect.left() - iconSize, leftHandleRect.bottom(), iconSize, iconSize, leftIcon);
69 | painter.drawPixmap(rightHandleRect.left(), rightHandleRect.bottom(), iconSize, iconSize, rightIcon);
70 | painter.end();
71 | }
72 |
73 | void TextEditor::mousePressEvent(QMouseEvent* e)
74 | {
75 | QTextEdit::mousePressEvent(e);
76 |
77 | /*QTextCursor cursor(textCursor());
78 | cursor.select(QTextCursor::WordUnderCursor);
79 | setTextCursor(cursor);*/
80 |
81 | //this->setFocus();
82 |
83 | //AmebaApp::inputMethod()->show();
84 | viewport()->repaint();
85 | }
86 |
87 | void TextEditor::mouseMoveEvent(QMouseEvent* e)
88 | {
89 | //QTextEdit::mouseMoveEvent(e);
90 | }
91 |
92 | void TextEditor::mouseReleaseEvent(QMouseEvent* e)
93 | {
94 | QTextEdit::mouseReleaseEvent(e);
95 | viewport()->repaint();
96 | }
97 |
98 | void TextEditor::onCursorPositionChanged()
99 | {
100 | viewport()->repaint();
101 | }
102 |
--------------------------------------------------------------------------------
/Source/TextEditor.h:
--------------------------------------------------------------------------------
1 |
2 | #pragma once
3 | #include
4 |
5 | class TextEditor : public QTextEdit
6 | {
7 | Q_OBJECT
8 |
9 | public:
10 | TextEditor(QWidget* parent = 0);
11 | ~TextEditor();
12 |
13 | protected:
14 | bool event(QEvent* e) override;
15 | void focusInEvent(QFocusEvent* e) override;
16 | void paintEvent(QPaintEvent* e) override;
17 | void mousePressEvent(QMouseEvent* e) override;
18 | void mouseMoveEvent(QMouseEvent* e) override;
19 | void mouseReleaseEvent(QMouseEvent* e) override;
20 | void inputMethodEvent(QInputMethodEvent* e) override;
21 |
22 | private slots:
23 | void onCursorPositionChanged();
24 | };
25 |
--------------------------------------------------------------------------------
/Source/main.cpp:
--------------------------------------------------------------------------------
1 |
2 | #include
3 |
4 | int main(int argc, char *argv[])
5 | {
6 | AmebaApp amebaApp(argc, argv);
7 | return amebaApp.exec();
8 | }
9 |
--------------------------------------------------------------------------------
/ameba.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | Images/Icon.png
4 | Images/LeftHandle.png
5 | Images/RightHandle.png
6 |
7 |
8 |
--------------------------------------------------------------------------------
/style.css:
--------------------------------------------------------------------------------
1 |
2 | QWidget
3 | {
4 | color: #C0C0C0;
5 | background-color: #2D2D2D;
6 | }
7 |
8 | QMenuBar::item
9 | {
10 | background: #2D2D2D;
11 | }
12 |
13 | QMenuBar::item:selected
14 | {
15 | background: #333333;
16 | }
17 |
18 | QMenu::item
19 | {
20 | background: #1B1B1B;
21 | }
22 |
23 | QMenu::item:selected
24 | {
25 | background: #333333;
26 | }
27 |
28 | QToolBar
29 | {
30 | border: none;
31 | }
32 |
33 | QTabWidget
34 | {
35 | border: none;
36 | }
37 |
38 | QTabWidget#documentsTabs
39 | {
40 | border: 1px solid;
41 | }
42 |
43 | QTabBar::tab
44 | {
45 | background: #2D2D2D;
46 | }
47 |
48 | QTabBar::tab:selected
49 | {
50 | color: #0E99DD;
51 | background: #1B1B1B;
52 | }
53 |
54 | QTabBar::tab:hover
55 | {
56 | color: #0E99DD;
57 | background: #3E3E3E;
58 | }
59 |
60 | QTabBar#documentsTabs::tab
61 | {
62 | color: white;
63 | background: #333333;
64 | }
65 |
66 | QTabBar#documentsTabs::tab:selected
67 | {
68 | background: #007ACC;
69 | }
70 |
71 | QTabBar#documentsTabs::tab:hover
72 | {
73 | background: #1C97EA;
74 | }
75 |
76 | QHeaderView::section
77 | {
78 | background-color: #2D2D2D;
79 | }
80 |
--------------------------------------------------------------------------------