mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 02:25:09 +00:00
display-*: return void for most calls as return-value is useless
This commit is contained in:
parent
fd683ee8ce
commit
e4b05557fa
@ -150,8 +150,7 @@ bool display_output_http::initialize() {
|
||||
|
||||
bool display_output_http::shutdown() { return true; }
|
||||
|
||||
bool display_output_http::begin_draw_text() {
|
||||
#ifdef BUILD_HTTP
|
||||
void display_output_http::begin_draw_text() {
|
||||
#define WEBPAGE_START1 \
|
||||
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" " \
|
||||
"\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html " \
|
||||
@ -171,25 +170,19 @@ bool display_output_http::begin_draw_text() {
|
||||
}
|
||||
webpage.append(WEBPAGE_START2);
|
||||
}
|
||||
#endif /* BUILD_HTTP */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool display_output_http::end_draw_text() {
|
||||
webpage.append(WEBPAGE_END);
|
||||
return true;
|
||||
}
|
||||
void display_output_http::end_draw_text() { webpage.append(WEBPAGE_END); }
|
||||
|
||||
bool display_output_http::draw_string(const char *s, int w) {
|
||||
void display_output_http::draw_string(const char *s, int w) {
|
||||
std::string::size_type origlen = webpage.length();
|
||||
webpage.append(s);
|
||||
webpage = string_replace_all(webpage, "\n", "<br />", origlen);
|
||||
webpage = string_replace_all(webpage, " ", " ", origlen);
|
||||
webpage = string_replace_all(webpage, " ", " ", origlen);
|
||||
webpage.append("<br />");
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* BUILD_HTTP */
|
||||
|
||||
} // namespace conky
|
||||
|
@ -48,9 +48,10 @@ class display_output_http : public display_output_base {
|
||||
virtual bool shutdown();
|
||||
|
||||
// drawing primitives
|
||||
virtual bool begin_draw_text();
|
||||
virtual bool end_draw_text();
|
||||
virtual bool draw_string(const char *s, int w);
|
||||
virtual void set_foreground_color(long c) {}
|
||||
virtual void begin_draw_text();
|
||||
virtual void end_draw_text();
|
||||
virtual void draw_string(const char *s, int w);
|
||||
|
||||
// HTTP-specific
|
||||
private:
|
||||
|
@ -74,27 +74,25 @@ bool display_output_ncurses::detect() {
|
||||
}
|
||||
|
||||
bool display_output_ncurses::initialize() {
|
||||
return (ncurses_window != nullptr);
|
||||
is_active = ncurses_window != nullptr;
|
||||
return is_active;
|
||||
}
|
||||
|
||||
bool display_output_ncurses::shutdown() { return false; }
|
||||
|
||||
bool display_output_ncurses::set_foreground_color(long c) {
|
||||
void display_output_ncurses::set_foreground_color(long c) {
|
||||
attron(COLOR_PAIR(c));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool display_output_ncurses::begin_draw_text() {
|
||||
void display_output_ncurses::begin_draw_text() {
|
||||
init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
|
||||
attron(COLOR_PAIR(COLOR_WHITE));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool display_output_ncurses::end_draw_text() { return true; }
|
||||
void display_output_ncurses::end_draw_text() {}
|
||||
|
||||
bool display_output_ncurses::draw_string(const char *s, int w) {
|
||||
void display_output_ncurses::draw_string(const char *s, int w) {
|
||||
printw("%s", s);
|
||||
return true;
|
||||
}
|
||||
|
||||
void display_output_ncurses::line_inner_done() { printw("\n"); }
|
||||
@ -111,29 +109,23 @@ int display_output_ncurses::gety() {
|
||||
return y;
|
||||
}
|
||||
|
||||
bool display_output_ncurses::gotox(int x) {
|
||||
void display_output_ncurses::gotox(int x) {
|
||||
int y, old_x;
|
||||
getyx(ncurses_window, y, old_x);
|
||||
move(y, x);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool display_output_ncurses::gotoy(int y) {
|
||||
void display_output_ncurses::gotoy(int y) {
|
||||
int x, old_y;
|
||||
getyx(ncurses_window, old_y, x);
|
||||
move(y, x);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool display_output_ncurses::gotoxy(int x, int y) {
|
||||
move(y, x);
|
||||
return true;
|
||||
}
|
||||
void display_output_ncurses::gotoxy(int x, int y) { move(y, x); }
|
||||
|
||||
bool display_output_ncurses::flush() {
|
||||
void display_output_ncurses::flush() {
|
||||
refresh();
|
||||
clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* BUILD_NCURSES */
|
||||
|
@ -46,22 +46,23 @@ class display_output_ncurses : public display_output_console {
|
||||
// connect to DISPLAY and other stuff
|
||||
virtual bool initialize();
|
||||
virtual bool shutdown();
|
||||
virtual bool draw_line_inner_required() { return true; }
|
||||
|
||||
// drawing primitives
|
||||
virtual bool set_foreground_color(long c);
|
||||
virtual void set_foreground_color(long c);
|
||||
|
||||
virtual bool begin_draw_text();
|
||||
virtual bool end_draw_text();
|
||||
virtual bool draw_string(const char *s, int w);
|
||||
virtual void begin_draw_text();
|
||||
virtual void end_draw_text();
|
||||
virtual void draw_string(const char *s, int w);
|
||||
virtual void line_inner_done();
|
||||
|
||||
virtual int getx();
|
||||
virtual int gety();
|
||||
virtual bool gotox(int x);
|
||||
virtual bool gotoy(int y);
|
||||
virtual bool gotoxy(int x, int y);
|
||||
virtual void gotox(int x);
|
||||
virtual void gotoy(int y);
|
||||
virtual void gotoxy(int x, int y);
|
||||
|
||||
virtual bool flush();
|
||||
virtual void flush();
|
||||
|
||||
// ncurses-specific
|
||||
};
|
||||
|
@ -23,6 +23,7 @@
|
||||
#ifndef DISPLAY_OUTPUT_HH
|
||||
#define DISPLAY_OUTPUT_HH
|
||||
|
||||
#include <string.h>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
@ -68,33 +69,60 @@ class display_output_base {
|
||||
}
|
||||
|
||||
// check if available and enabled in settings
|
||||
virtual bool detect() { return false; };
|
||||
virtual bool detect() { return false; }
|
||||
// connect to DISPLAY and other stuff
|
||||
virtual bool initialize() { return false; };
|
||||
virtual bool shutdown() { return false; };
|
||||
virtual bool initialize() { return false; }
|
||||
virtual bool shutdown() { return false; }
|
||||
|
||||
virtual bool graphical() { return is_graphical; };
|
||||
virtual bool draw_line_inner_required() { return is_graphical; }
|
||||
|
||||
virtual bool main_loop_wait(double t) { return false; }
|
||||
|
||||
virtual void sigterm_cleanup() {}
|
||||
virtual void cleanup() {}
|
||||
|
||||
// drawing primitives
|
||||
virtual bool set_foreground_color(long c) { return false; }
|
||||
virtual void set_foreground_color(long c) {}
|
||||
|
||||
virtual bool begin_draw_text() { return false; };
|
||||
virtual bool end_draw_text() { return false; };
|
||||
virtual bool draw_string(const char *s, int w) { return false; };
|
||||
virtual int calc_text_width(const char *s) { return strlen(s); }
|
||||
|
||||
virtual void begin_draw_text() {}
|
||||
virtual void end_draw_text() {}
|
||||
virtual void draw_string(const char *s, int w) {}
|
||||
virtual void line_inner_done() {}
|
||||
|
||||
virtual int getx() { return 0; };
|
||||
virtual int gety() { return 0; };
|
||||
virtual bool gotox(int x) { return false; };
|
||||
virtual bool gotoy(int y) { return false; };
|
||||
virtual bool gotoxy(int x, int y) { return false; };
|
||||
// GUI interface
|
||||
virtual void draw_string_at(int x, int y, const char *s, int w) {}
|
||||
// X11 lookalikes
|
||||
virtual void set_line_style(int w, bool solid) {}
|
||||
virtual void set_dashes(char *s) {}
|
||||
virtual void draw_line(int x1, int y1, int x2, int y2) {}
|
||||
virtual void draw_rect(int x, int y, int w, int h) {}
|
||||
virtual void fill_rect(int x, int y, int w, int h) {}
|
||||
virtual void draw_arc(int x, int y, int w, int h, int a1, int a2) {}
|
||||
virtual void move_win(int x, int y) {}
|
||||
|
||||
virtual bool flush() { return false; };
|
||||
virtual void begin_draw_stuff() {}
|
||||
virtual void end_draw_stuff() {}
|
||||
virtual void swap_buffers() {}
|
||||
virtual void clear_text(int exposures) {}
|
||||
virtual void load_fonts(bool utf8) {}
|
||||
|
||||
// tty interface
|
||||
virtual int getx() { return 0; }
|
||||
virtual int gety() { return 0; }
|
||||
virtual void gotox(int x) {}
|
||||
virtual void gotoy(int y) {}
|
||||
virtual void gotoxy(int x, int y) {}
|
||||
|
||||
virtual void flush() {}
|
||||
|
||||
friend bool conky::initialize_display_outputs();
|
||||
friend bool conky::shutdown_display_outputs();
|
||||
|
||||
protected:
|
||||
virtual bool active() { return is_active; };
|
||||
virtual bool graphical() { return is_graphical; };
|
||||
virtual bool active() { return is_active; }
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user