aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-31 18:12:49 +0100
committerdec05eba <dec05eba@protonmail.com>2018-10-31 18:12:53 +0100
commita535703add6bf29878845cb270997514489cfc16 (patch)
tree6816c8749c0dde59cc936cdc274307b0561bac27 /include
parent687796532d80fc6a0ae8327eec8f901002bdc0dd (diff)
Start with images/gif, resize chat input
Diffstat (limited to 'include')
-rw-r--r--include/Cache.hpp16
-rw-r--r--include/ChannelDataType.hpp2
-rw-r--r--include/ChatMessage.hpp7
-rw-r--r--include/ChatWindow.hpp5
-rw-r--r--include/GlobalCache.hpp8
-rw-r--r--include/GtkGif.hpp24
-rw-r--r--include/env.hpp59
-rw-r--r--include/types.hpp22
8 files changed, 41 insertions, 102 deletions
diff --git a/include/Cache.hpp b/include/Cache.hpp
deleted file mode 100644
index 97ef495..0000000
--- a/include/Cache.hpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#pragma once
-
-#include <boost/filesystem/path.hpp>
-
-namespace dchat
-{
- class Cache
- {
- public:
- Cache();
- ~Cache();
-
- // Creates directory if it doesn't exist (recursively). Throws boost exception on failure
- static boost::filesystem::path getDchatDir();
- };
-}
diff --git a/include/ChannelDataType.hpp b/include/ChannelDataType.hpp
index 398e716..21e828d 100644
--- a/include/ChannelDataType.hpp
+++ b/include/ChannelDataType.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "types.hpp"
+#include <dchat/types.hpp>
namespace dchat
{
diff --git a/include/ChatMessage.hpp b/include/ChatMessage.hpp
index 271aa5f..c13db9d 100644
--- a/include/ChatMessage.hpp
+++ b/include/ChatMessage.hpp
@@ -1,6 +1,6 @@
#pragma once
-#include "types.hpp"
+#include <dchat/types.hpp>
#include <gtkmm/grid.h>
#include <gtkmm/label.h>
@@ -11,10 +11,13 @@ namespace dchat
{
public:
ChatMessage(const Glib::ustring &username, const Glib::ustring &text, uint32_t timestampSeconds, const User *user);
-
+
+ Gtk::Grid avatar;
Gtk::Label username;
Gtk::Label text;
uint32_t timestampSeconds;
const User *user;
+ private:
+ bool updateContent(const Cairo::RefPtr<Cairo::Context> &cairo);
};
} \ No newline at end of file
diff --git a/include/ChatWindow.hpp b/include/ChatWindow.hpp
index b10af2b..0b58506 100644
--- a/include/ChatWindow.hpp
+++ b/include/ChatWindow.hpp
@@ -38,8 +38,8 @@ namespace dchat
Gtk::Grid leftPanelChannels;
Gtk::Grid leftPanelUsers;
Gtk::Label currentChannelTitle;
- Gtk::ScrolledWindow chatArea;
- Gtk::Grid chatAreaLayout;
+ Gtk::ScrolledWindow messageArea;
+ Gtk::Grid messageAreaLayout;
Gtk::TextView chatInput;
struct ChannelData
@@ -53,5 +53,6 @@ namespace dchat
std::vector<User*> users;
ChatMessage *lastMessage;
+ int chatPrevNumLines;
};
} \ No newline at end of file
diff --git a/include/GlobalCache.hpp b/include/GlobalCache.hpp
new file mode 100644
index 0000000..0b48e1c
--- /dev/null
+++ b/include/GlobalCache.hpp
@@ -0,0 +1,8 @@
+#pragma once
+
+#include <dchat/Cache.hpp>
+
+namespace dchat
+{
+ Cache& getGlobalCache();
+} \ No newline at end of file
diff --git a/include/GtkGif.hpp b/include/GtkGif.hpp
new file mode 100644
index 0000000..91b3a12
--- /dev/null
+++ b/include/GtkGif.hpp
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <dchat/Gif.hpp>
+#include <gtkmm/drawingarea.h>
+#include <gdkmm/pixbuf.h>
+
+namespace dchat
+{
+ class GtkGif : public Gif, public Gtk::DrawingArea
+ {
+ public:
+ GtkGif(StringView fileContent);
+ virtual ~GtkGif(){}
+ protected:
+ // Return false if texture creation failed
+ bool createTexture(int width, int height) override;
+ // Size of texture data is same as the size that the texture was created with (also same size returned by @getSize function)
+ void updateTexture(void *textureData) override;
+ private:
+ bool on_draw(const Cairo::RefPtr<Cairo::Context> &cairo) override;
+ private:
+ Cairo::RefPtr<Cairo::ImageSurface> surface;
+ };
+} \ No newline at end of file
diff --git a/include/env.hpp b/include/env.hpp
deleted file mode 100644
index 57ae068..0000000
--- a/include/env.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-#pragma once
-
-#define OS_FAMILY_WINDOWS 0
-#define OS_FAMILY_POSIX 1
-
-#define OS_TYPE_WINDOWS 0
-#define OS_TYPE_LINUX 1
-
-#if defined(_WIN32) || defined(_WIN64)
- #if defined(_WIN64)
- #define SYS_ENV_64BIT
- #else
- #define SYS_ENV_32BIT
- #endif
- #define OS_FAMILY OS_FAMILY_WINDOWS
- #define OS_TYPE OS_TYPE_WINDOWS
-
- #ifndef UNICODE
- #define UNICODE
- #endif
-
- #ifndef _UNICODE
- #define _UNICODE
- #endif
-
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
-
- #include <windows.h>
-#endif
-
-#if defined(__linux__) || defined(__unix__) || defined(__APPLE__) || defined(_POSIX_VERSION)
- #define OS_FAMILY OS_FAMILY_POSIX
-#endif
-
-#ifdef __linux__
- #define OS_TYPE OS_TYPE_LINUX
-#endif
-
-#if defined(__GNUC__)
- #if defined(__x86_64__) || defined(__pc64__)
- #define SYS_ENV_64BIT
- #else
- #define SYS_ENV_32BIT
- #endif
-#endif
-
-#if !defined(SYS_ENV_32BIT) && !defined(SYS_ENV_64BIT)
- #error "System is not detected as either 32-bit or 64-bit"
-#endif
-
-#if !defined(OS_FAMILY)
- #error "System not supported. Only Windows and Posix systems supported right now"
-#endif
-
-#if !defined(OS_TYPE)
- #error "System not supported. Only Windows and linux systems supported right now"
-#endif
diff --git a/include/types.hpp b/include/types.hpp
deleted file mode 100644
index 762dab1..0000000
--- a/include/types.hpp
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include <cstdint>
-
-namespace dchat
-{
- typedef int8_t i8;
- typedef int16_t i16;
- typedef int32_t i32;
- typedef int64_t i64;
-
- typedef uint8_t u8;
- typedef uint16_t u16;
- typedef uint32_t u32;
- typedef uint64_t u64;
-
- typedef float f32;
- typedef double f64;
-
- typedef intptr_t ssize;
- typedef uintptr_t usize;
-}