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.
 
 
 

67 lines
1.7 KiB

#include <iostream>
#include <stdio.h>
#include <curses.h>
#include <QCoreApplication>
#include <QThread>
#include "menu.h"
int main(int argc, char *argv[]) {
QCoreApplication app(argc, argv);
app.setOrganizationName("fiveforty");
app.setApplicationName("tui");
initscr();
refresh();
keypad(stdscr, TRUE);
nonl();
cbreak();
noecho();
if(has_colors()) {
start_color();
/*
* Simple color assignment, often all we need. Color pair 0 cannot
* be redefined. This example uses the same value for the color
* pair as for the foreground color, though of course that is not
* necessary:
*/
//init_color(COLOR_DARK_GRAY, 256, 256, 256);
init_pair(1, COLOR_RED, COLOR_BLACK);
init_pair(2, COLOR_GREEN, COLOR_BLACK);
init_pair(3, COLOR_YELLOW, COLOR_BLACK);
init_pair(4, COLOR_BLUE, COLOR_BLACK);
init_pair(5, COLOR_CYAN, COLOR_BLACK);
init_pair(6, COLOR_MAGENTA, COLOR_BLACK);
init_pair(7, COLOR_WHITE, COLOR_BLACK);
init_pair(8, COLOR_WHITE, COLOR_BLUE);
//init_pair(9, COLOR_WHITE, COLOR_GREEN);
}else{
printf("Your terminal does not support colors\n");
endwin();
return 1;
}
WINDOW *window = newwin(0, 0, 0, 0);
//printf("\e[1;1H\e[2J");
QThread *thread = new QThread;
Menu *menu = new Menu(window);
menu->moveToThread(thread);
QObject::connect(thread, SIGNAL(started()), menu, SLOT(start()));
QObject::connect(menu, SIGNAL(finished()), thread, SLOT(quit()));
QObject::connect(menu, SIGNAL(finished()), menu, SLOT(deleteLater()));
QObject::connect(menu, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
int ret = app.exec();
return ret;
return 0;
}