mirror of
https://github.com/correl/mercenary.git
synced 2024-11-23 11:09:50 +00:00
Updates to the gui app to fix command entering
Additional flags for the build process to get the gui app compiled properly across operating systems Parsing ready for event scripts git-svn-id: file:///srv/svn/ircclient/trunk@13 a9804ffe-773b-11dd-bd7c-89c3ef1d2733
This commit is contained in:
parent
7b49d382f0
commit
a8443598b8
6 changed files with 74 additions and 25 deletions
|
@ -13,6 +13,12 @@ add_subdirectory(src)
|
||||||
add_subdirectory(mirc)
|
add_subdirectory(mirc)
|
||||||
add_subdirectory(testapp)
|
add_subdirectory(testapp)
|
||||||
if (WITH_GUI)
|
if (WITH_GUI)
|
||||||
|
if (WIN32)
|
||||||
|
set (GUI_TYPE WIN32)
|
||||||
|
endif()
|
||||||
|
if (APPLE)
|
||||||
|
set (GUI_TYPE MACOSX_BUNDLE)
|
||||||
|
endif()
|
||||||
set (QT_DONT_USE_QTGUI FALSE)
|
set (QT_DONT_USE_QTGUI FALSE)
|
||||||
include (${QT_USE_FILE})
|
include (${QT_USE_FILE})
|
||||||
set (LIBS ${QT_LIBRARIES})
|
set (LIBS ${QT_LIBRARIES})
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>ChatWindow</class>
|
<class>ChatWindow</class>
|
||||||
<widget class="QWidget" name="ChatWindow" >
|
<widget class="QWidget" name="ChatWindow">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
|
@ -9,25 +10,31 @@
|
||||||
<height>300</height>
|
<height>300</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTextBrowser" name="display" >
|
<widget class="QTextBrowser" name="display">
|
||||||
<property name="styleSheet" >
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Monospace</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="html" >
|
<property name="html">
|
||||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||||
|
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
p, li { white-space: pre-wrap; }
|
p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Monospace'; font-size:10pt; font-weight:400; font-style:normal;">
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="input" />
|
<widget class="QLineEdit" name="input"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -10,7 +10,7 @@ MessageHandler::MessageHandler( IRCClient *irc, QWidget *parent ) : QTabWidget(
|
||||||
connect( irc, SIGNAL( sentRAW( QString ) ), this, SLOT( sentRAW( QString ) ) );
|
connect( irc, SIGNAL( sentRAW( QString ) ), this, SLOT( sentRAW( QString ) ) );
|
||||||
connect( irc, SIGNAL( rcvdRAW( QString ) ), this, SLOT( rcvdRAW( QString ) ) );
|
connect( irc, SIGNAL( rcvdRAW( QString ) ), this, SLOT( rcvdRAW( QString ) ) );
|
||||||
this->setTabPosition( QTabWidget::South );
|
this->setTabPosition( QTabWidget::South );
|
||||||
_addWindow( "status", "", true );
|
_addWindow( "status", "say", true );
|
||||||
|
|
||||||
DCCPortMin = 1024;
|
DCCPortMin = 1024;
|
||||||
DCCPortMax = 5000;
|
DCCPortMax = 5000;
|
||||||
|
@ -66,7 +66,7 @@ void MessageHandler::messageRcvd( QString type, QString src, QString dest, QStri
|
||||||
|
|
||||||
// Handle special messages first
|
// Handle special messages first
|
||||||
if( type == "JOIN" ) {
|
if( type == "JOIN" ) {
|
||||||
_addWindow( text, "msg " + text, true );
|
_addWindow( text, "say", true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !dest.isEmpty() && dest.startsWith( '#' ) ) {
|
if( !dest.isEmpty() && dest.startsWith( '#' ) ) {
|
||||||
|
@ -89,19 +89,19 @@ void MessageHandler::messageRcvd( QString type, QString src, QString dest, QStri
|
||||||
}
|
}
|
||||||
|
|
||||||
//emit dispatchMessage( window, src, message );
|
//emit dispatchMessage( window, src, message );
|
||||||
_addWindow( window, "msg " + window );
|
_addWindow( window, "say" );
|
||||||
windows[window]->message( source, message );
|
windows[window]->message( source, message );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageHandler::messageSentDCC( QString nickName, QString text ) {
|
void MessageHandler::messageSentDCC( QString nickName, QString text ) {
|
||||||
QString window = nickName.prepend( "=" );
|
QString window = nickName.prepend( "=" );
|
||||||
_addWindow( window, "msg " + window );
|
_addWindow( window, "say" );
|
||||||
windows[window]->message( irc->getNickName(), text );
|
windows[window]->message( irc->getNickName(), text );
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageHandler::messageRcvdDCC( QString nickName, QString text ) {
|
void MessageHandler::messageRcvdDCC( QString nickName, QString text ) {
|
||||||
QString window = "=" + nickName;
|
QString window = "=" + nickName;
|
||||||
_addWindow( window, "msg " + window );
|
_addWindow( window, "say" );
|
||||||
windows[window]->message( nickName, text );
|
windows[window]->message( nickName, text );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ void MessageHandler::connectedDCCChat( QString nickName ) {
|
||||||
connect( dcc, SIGNAL( rcvdText( QString, QString ) ), this, SLOT( messageRcvdDCC( QString, QString ) ) );
|
connect( dcc, SIGNAL( rcvdText( QString, QString ) ), this, SLOT( messageRcvdDCC( QString, QString ) ) );
|
||||||
connect( dcc, SIGNAL( sentText( QString, QString ) ), this, SLOT( messageSentDCC( QString, QString ) ) );
|
connect( dcc, SIGNAL( sentText( QString, QString ) ), this, SLOT( messageSentDCC( QString, QString ) ) );
|
||||||
QString window = nickName.prepend( "=" );
|
QString window = nickName.prepend( "=" );
|
||||||
_addWindow( window, "msg " + window );
|
_addWindow( window, "say" );
|
||||||
windows[window]->echo( "DCC Chat Connected" );
|
windows[window]->echo( "DCC Chat Connected" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ void MessageHandler::alias_msg(QStringList args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void MessageHandler::alias_nick(QStringList args) {
|
void MessageHandler::alias_nick(QStringList args) {
|
||||||
if( args.count() > 1 ) {
|
if( args.count() > 0 ) {
|
||||||
irc->nick( args[0] );
|
irc->nick( args[0] );
|
||||||
}
|
}
|
||||||
this->scriptManager->return_value(irc->getNickName());
|
this->scriptManager->return_value(irc->getNickName());
|
||||||
|
|
|
@ -58,9 +58,10 @@ private:
|
||||||
QStringList current_value;
|
QStringList current_value;
|
||||||
QStack<QStringList> stack;
|
QStack<QStringList> stack;
|
||||||
QString _alias;
|
QString _alias;
|
||||||
|
mirc_engine_stage stage;
|
||||||
|
bool fetch;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
mirc_engine_stage stage;
|
|
||||||
mirc_alias script;
|
mirc_alias script;
|
||||||
mirc_aliases aliases;
|
mirc_aliases aliases;
|
||||||
mirc_variables vars;
|
mirc_variables vars;
|
||||||
|
@ -69,9 +70,11 @@ public:
|
||||||
mirc_script_engine(MIRCScriptManager *m);
|
mirc_script_engine(MIRCScriptManager *m);
|
||||||
|
|
||||||
void set_stage(mirc_engine_stage _stage);
|
void set_stage(mirc_engine_stage _stage);
|
||||||
|
void set_fetch(bool _fetch);
|
||||||
|
|
||||||
void handle_alias_definition(char const* str, char const* end);
|
void handle_alias_definition(char const* str, char const* end);
|
||||||
void handle_alias_definition_local(char const* str, char const* end);
|
void handle_alias_definition_local(char const* str, char const* end);
|
||||||
|
void handle_event_definition(char const* str, char const* end);
|
||||||
void close_alias(char const*, char const*);
|
void close_alias(char const*, char const*);
|
||||||
void store_code(char const* str, char const* end);
|
void store_code(char const* str, char const* end);
|
||||||
void code_line(char const* str, char const* end);
|
void code_line(char const* str, char const* end);
|
||||||
|
@ -109,6 +112,8 @@ struct mirc_script : public grammar<mirc_script> {
|
||||||
alias_action,
|
alias_action,
|
||||||
alias_function,
|
alias_function,
|
||||||
alias_definition,
|
alias_definition,
|
||||||
|
event_option,
|
||||||
|
event_definition,
|
||||||
code_line,
|
code_line,
|
||||||
code_block,
|
code_block,
|
||||||
comment;
|
comment;
|
||||||
|
@ -118,6 +123,7 @@ struct mirc_script : public grammar<mirc_script> {
|
||||||
typedef function< void(const char*, const char*) > s_action;
|
typedef function< void(const char*, const char*) > s_action;
|
||||||
s_action a_def ( bind( &mirc_script_engine::handle_alias_definition, self.actions, _1, _2 ) );
|
s_action a_def ( bind( &mirc_script_engine::handle_alias_definition, self.actions, _1, _2 ) );
|
||||||
s_action l_def ( bind( &mirc_script_engine::handle_alias_definition_local, self.actions, _1, _2 ) );
|
s_action l_def ( bind( &mirc_script_engine::handle_alias_definition_local, self.actions, _1, _2 ) );
|
||||||
|
s_action e_def ( bind( &mirc_script_engine::handle_event_definition, self.actions, _1, _2 ) );
|
||||||
s_action a_close ( bind( &mirc_script_engine::close_alias, self.actions, _1, _2 ) );
|
s_action a_close ( bind( &mirc_script_engine::close_alias, self.actions, _1, _2 ) );
|
||||||
s_action a_set ( bind( &mirc_script_engine::set_alias, self.actions, _1, _2 ) );
|
s_action a_set ( bind( &mirc_script_engine::set_alias, self.actions, _1, _2 ) );
|
||||||
s_action a_call ( bind( &mirc_script_engine::call_alias, self.actions, _1, _2 ) );
|
s_action a_call ( bind( &mirc_script_engine::call_alias, self.actions, _1, _2 ) );
|
||||||
|
@ -134,6 +140,7 @@ struct mirc_script : public grammar<mirc_script> {
|
||||||
script
|
script
|
||||||
= *(
|
= *(
|
||||||
alias_definition[a_close]
|
alias_definition[a_close]
|
||||||
|
| event_definition
|
||||||
| code_block
|
| code_block
|
||||||
) >> end_p
|
) >> end_p
|
||||||
;
|
;
|
||||||
|
@ -195,12 +202,24 @@ struct mirc_script : public grammar<mirc_script> {
|
||||||
>> *space >> !eol_p[c_line]
|
>> *space >> !eol_p[c_line]
|
||||||
>> code_block
|
>> code_block
|
||||||
;
|
;
|
||||||
|
event_option
|
||||||
|
= (+(graph_p - ch_p(':')))
|
||||||
|
;
|
||||||
|
event_definition
|
||||||
|
= str_p("on") >> *space
|
||||||
|
>> ( //event_option >> ch_p(':') >> event_option /* level:EVENT */
|
||||||
|
//>> *(ch_p(':') >> event_option) >> ch_p(':') /* options */
|
||||||
|
+(event_option[v_append][e_append] >> ch_p(':'))
|
||||||
|
)[e_def]
|
||||||
|
>> code_block
|
||||||
|
;
|
||||||
code_line
|
code_line
|
||||||
= *space
|
= *space
|
||||||
>> ( comment[c_line]
|
>> ( comment[c_line]
|
||||||
| (
|
| (
|
||||||
assignment /* Must come first to avoid "var" being caught as an action */
|
assignment /* Must come first to avoid "var" being caught as an action */
|
||||||
| alias_action
|
| alias_action
|
||||||
|
| eol_p[c_line]
|
||||||
)[s_code]
|
)[s_code]
|
||||||
)[c_stack]
|
)[c_stack]
|
||||||
>> !eol_p[c_line]
|
>> !eol_p[c_line]
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
mirc_script_engine::mirc_script_engine(MIRCScriptManager *m) : script() {
|
mirc_script_engine::mirc_script_engine(MIRCScriptManager *m) : script() {
|
||||||
manager = m;
|
manager = m;
|
||||||
set_stage(PARSE);
|
set_stage(PARSE);
|
||||||
|
set_fetch(true);
|
||||||
current_alias = aliases.end();
|
current_alias = aliases.end();
|
||||||
current_variable = vars.end();
|
current_variable = vars.end();
|
||||||
}
|
}
|
||||||
|
@ -13,6 +14,9 @@ void mirc_script_engine::set_stage(mirc_engine_stage _stage) {
|
||||||
this->stage = _stage;
|
this->stage = _stage;
|
||||||
this->line = 1;
|
this->line = 1;
|
||||||
}
|
}
|
||||||
|
void mirc_script_engine::set_fetch(bool _fetch) {
|
||||||
|
this->fetch = _fetch;
|
||||||
|
}
|
||||||
|
|
||||||
void mirc_script_engine::handle_alias_definition(char const* str, char const* end) {
|
void mirc_script_engine::handle_alias_definition(char const* str, char const* end) {
|
||||||
if (stage != PARSE) return;
|
if (stage != PARSE) return;
|
||||||
|
@ -36,6 +40,11 @@ void mirc_script_engine::close_alias(char const*, char const*) {
|
||||||
current_alias = aliases.end();
|
current_alias = aliases.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void mirc_script_engine::handle_event_definition(char const* str, char const* end) {
|
||||||
|
if (stage != PARSE) return;
|
||||||
|
string s(str, end);
|
||||||
|
qDebug() << "EVENT DEFINITION" << s.c_str();
|
||||||
|
}
|
||||||
void mirc_script_engine::store_code(char const* str, char const* end) {
|
void mirc_script_engine::store_code(char const* str, char const* end) {
|
||||||
if (stage != PARSE) return;
|
if (stage != PARSE) return;
|
||||||
|
|
||||||
|
@ -63,7 +72,7 @@ void mirc_script_engine::call_alias(char const* str, char const* end) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
}
|
}
|
||||||
void mirc_script_engine::return_alias(char const* str, char const* end) {
|
void mirc_script_engine::return_alias(char const* str, char const* end) {
|
||||||
if (stage != EXECUTE) return;
|
if (stage != EXECUTE || !fetch) return;
|
||||||
string s(str, end);
|
string s(str, end);
|
||||||
manager->call_alias(_alias, stack.top());
|
manager->call_alias(_alias, stack.top());
|
||||||
stack.pop();
|
stack.pop();
|
||||||
|
@ -88,7 +97,7 @@ void mirc_script_engine::assign_variable(char const* str, char const* end) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void mirc_script_engine::fetch_variable(char const*, char const*) {
|
void mirc_script_engine::fetch_variable(char const*, char const*) {
|
||||||
if (stage != EXECUTE) return;
|
if (stage != EXECUTE || !fetch) return;
|
||||||
|
|
||||||
if (!current_value.isEmpty()) {
|
if (!current_value.isEmpty()) {
|
||||||
QString var = current_value.last();
|
QString var = current_value.last();
|
||||||
|
|
|
@ -4,6 +4,9 @@ echo TEST Code line match [ 2 = $line ]
|
||||||
echo TEST Code line match [ 4 = $line ]
|
echo TEST Code line match [ 4 = $line ]
|
||||||
set name Correl
|
set name Correl
|
||||||
%first = Correl
|
%first = Correl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
%middle = Joseph
|
%middle = Joseph
|
||||||
%name = %first $&
|
%name = %first $&
|
||||||
%middle Roush
|
%middle Roush
|
||||||
|
@ -22,6 +25,11 @@ alias -l getversion {
|
||||||
}
|
}
|
||||||
alias -l showversion {
|
alias -l showversion {
|
||||||
echo You're testing Mercenary $getversion
|
echo You're testing Mercenary $getversion
|
||||||
echo TEST Code line match [ 23 = $line ]
|
echo TEST Code line match [ 25 = $line ]
|
||||||
|
}
|
||||||
|
on *:TEXT:something:echo hey I got a message
|
||||||
|
|
||||||
|
on *:QUIT:{
|
||||||
|
echo Quitting!
|
||||||
}
|
}
|
||||||
dostuff
|
dostuff
|
||||||
|
|
Loading…
Reference in a new issue