Fixed #71: newline supported in 2.0 messages
This commit is contained in:
		
							parent
							
								
									a1ad346cea
								
							
						
					
					
						commit
						5eb5e77668
					
				
							
								
								
									
										4
									
								
								jsc.h
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								jsc.h
									
									
									
									
									
								
							| @ -40,8 +40,8 @@ public: | ||||
|     static const Tuple map[262144]; | ||||
|     static const Tuple list[262144]; | ||||
| 
 | ||||
|     static const quint32 prefixSize = 69; | ||||
|     static const Tuple prefix[69]; | ||||
|     static const quint32 prefixSize = 70; | ||||
|     static const Tuple prefix[70]; | ||||
| }; | ||||
| 
 | ||||
| #endif // JSC_H
 | ||||
|  | ||||
| @ -180080,8 +180080,8 @@ const Tuple JSC::list[262144] = { | ||||
| 	{"FTAD", 4, 112460}, | ||||
| 	{"FTAC", 4, 68872}, | ||||
| 	{"FTAB", 4, 72752}, | ||||
|     {"\\", 1, 69}, | ||||
|     {"FT8", 3, 68}, | ||||
|     {"\n", 1, 69}, // FYI: this used to be "\" in JS8 1.0
 | ||||
|     {"\\", 1, 68}, // FYI: this used to be FT8 in JS8 1.0
 | ||||
| 	{"FSYW", 4, 155790}, | ||||
| 	{"FSYT", 4, 186523}, | ||||
| 	{"FSYS", 4, 69541}, | ||||
| @ -262167,7 +262167,7 @@ const Tuple JSC::list[262144] = { | ||||
|     {"!", 1, 28}, | ||||
| }; | ||||
| 
 | ||||
| const Tuple JSC::prefix[69] = { | ||||
| const Tuple JSC::prefix[70] = { | ||||
| 	{"!", 1, 262143},  | ||||
| 	{"\"", 1, 262142},  | ||||
| 	{"#", 1, 262141},  | ||||
| @ -262205,7 +262205,8 @@ const Tuple JSC::prefix[69] = { | ||||
| 	{"C", 17608, 216261},  | ||||
| 	{"D", 13749, 202512},  | ||||
|     {"E", 12403, 190109}, | ||||
|     {"\\", 1, 180059}, | ||||
|     {"\\", 1, 180060}, | ||||
|     {"\n", 1, 180059}, | ||||
| 	{"F", 11252, 178857},  | ||||
| 	{"G", 10672, 168185},  | ||||
| 	{"H", 9060, 159125},  | ||||
|  | ||||
| @ -89,8 +89,8 @@ const Tuple JSC::map[262144] = { | ||||
| 	{"`", 1, 65}, | ||||
| 	{"~", 1, 66}, | ||||
|     {" ", 1, 67}, | ||||
|     {"FT8", 3, 68}, | ||||
|     {"\\", 1, 69}, | ||||
|     {"\\", 1, 68}, // FYI: this used to be FT8 in JS8 1.0
 | ||||
|     {"\n", 1, 69}, // FYI: this used to be "\" in JS8 1.0
 | ||||
| 	{"JS8", 3, 70}, | ||||
| 	{"JS8CALL", 7, 71}, | ||||
| 	{"JSQSO", 5, 72}, | ||||
|  | ||||
| @ -980,8 +980,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, | ||||
|   auto enterFilter = new EnterKeyPressEater(); | ||||
|   connect(enterFilter, &EnterKeyPressEater::enterKeyPressed, this, [this](QObject *, QKeyEvent *, bool *pProcessed){ | ||||
|       if(QApplication::keyboardModifiers() & Qt::ShiftModifier){ | ||||
|           // do not allow shift+enter
 | ||||
|           if(pProcessed) *pProcessed = true; | ||||
|           if(pProcessed) *pProcessed = false; | ||||
|           return; | ||||
|       } | ||||
|       if(ui->extFreeTextMsgEdit->isReadOnly()){ | ||||
| @ -6411,7 +6410,7 @@ void MainWindow::displayTextForFreq(QString text, int freq, QDateTime date, bool | ||||
|         block = -1; | ||||
|     } | ||||
| 
 | ||||
|     block = writeMessageTextToUI(date, text.replace("\\n", "\n"), freq, isTx, block); | ||||
|     block = writeMessageTextToUI(date, text, freq, isTx, block); | ||||
| 
 | ||||
|     // never cache tx or last lines
 | ||||
|     if(/*isTx || */isLast) { | ||||
| @ -6483,6 +6482,7 @@ int MainWindow::writeMessageTextToUI(QDateTime date, QString text, int freq, boo | ||||
|         c.insertText(text); | ||||
|     } else { | ||||
|         text = text.toHtmlEscaped(); | ||||
|         text = text.replace("\n", "<br/>"); | ||||
|         text = text.replace("  ", "  "); | ||||
|         c.insertBlock(); | ||||
|         c.insertHtml(QString("%1 - (%2) - %3").arg(date.time().toString()).arg(freq).arg(text)); | ||||
|  | ||||
							
								
								
									
										18
									
								
								varicode.cpp
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								varicode.cpp
									
									
									
									
									
								
							| @ -327,6 +327,16 @@ int dbmTomwatts(int dbm){ | ||||
|     return iter.value(); | ||||
| } | ||||
| 
 | ||||
| QString Varicode::escape(const QString &text){ | ||||
|     // // TODO: support different escapes?
 | ||||
|     return text; | ||||
| } | ||||
| 
 | ||||
| QString Varicode::unescape(const QString &text){ | ||||
|     // // TODO: support different escapes?
 | ||||
|     return text; | ||||
| } | ||||
| 
 | ||||
| QString Varicode::rstrip(const QString& str) { | ||||
|   int n = str.size() - 1; | ||||
|   for (; n >= 0; --n) { | ||||
| @ -1844,7 +1854,13 @@ QList<QPair<QString, int>> Varicode::buildMessageFrames(QString const& mycall, | ||||
| 
 | ||||
|     QList<QPair<QString, int>> allFrames; | ||||
| 
 | ||||
|     foreach(QString line, text.split(QRegExp("[\\r\\n]"), QString::SkipEmptyParts)){ | ||||
| #if JS8_NO_MULTILINE | ||||
|     // auto lines = text.split(QRegExp("[\\r\\n]"), QString::SkipEmptyParts);
 | ||||
| #else | ||||
|     QStringList lines = { text }; | ||||
| #endif | ||||
| 
 | ||||
|     foreach(QString line, lines){ | ||||
|         QList<QPair<QString, int>> lineFrames; | ||||
| 
 | ||||
|         // once we find a directed call, data encode the rest of the line.
 | ||||
|  | ||||
| @ -78,6 +78,9 @@ public: | ||||
| 
 | ||||
|     //Varicode();
 | ||||
| 
 | ||||
|     static QString escape(const QString &text); | ||||
|     static QString unescape(const QString &text); | ||||
| 
 | ||||
|     static QString rstrip(const QString& str); | ||||
|     static QString lstrip(const QString& str); | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jordan Sherer
						Jordan Sherer