You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.7 KiB

#ifndef JUCI_TERMINAL_H_
#define JUCI_TERMINAL_H_
#include <mutex>
#include <functional>
#include "gtkmm.h"
#include <boost/filesystem.hpp>
#include <thread>
#include <atomic>
namespace Terminal {
class Config {
public:
std::vector<std::string> compile_commands;
std::string run_command;
};
class View : public Gtk::HBox {
public:
View();
Gtk::TextView text_view;
Gtk::ScrolledWindow scrolled_window;
}; // class view
class Controller;
//Temporary solution for displaying functions in progress, and when they are done.
class InProgress {
public:
InProgress(const std::string& start_msg);
~InProgress();
void done(const std::string& msg);
void cancel(const std::string& msg);
private:
11 years ago
void start(const std::string& msg);
int line_nr;
std::atomic<bool> stop;
Glib::Dispatcher waiting_print;
std::thread wait_thread;
};
class Controller {
public:
Controller();
void SetFolderCommand(boost::filesystem::path CMake_path);
void Run(std::string executable);
void Compile();
int print(std::string message);
void print(int line_nr, std::string message);
std::shared_ptr<InProgress> print_in_progress(std::string start_msg);
Terminal::View view;
private:
void ExecuteCommand(std::string command, std::string mode);
bool OnButtonRealeaseEvent(GdkEventKey* key);
bool ExistInConsole(std::string string);
std::string folder_command_;
std::string path_;
const std::string cmake_sucsess = "Build files have been written to:";
const std::string make_built = "Built target";
const std::string make_executable = "Linking CXX executable";
}; // class controller
} // namespace Terminal
#endif // JUCI_TERMINAL_H_