Skip to content

Commit d08632d

Browse files
committed
src:add more shortcut
Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
1 parent c3a97a1 commit d08632d

27 files changed

+67
-211
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- 快速连接支持选择仅打开会话和仅保存会话
66
- 改进书签管理功能
7+
- 实现保存设置和自动保存设置按钮功能
8+
- 增加ALT+'-'、ALT+'='、ALT+LEFT、ALT+RIGHT四个实用全局快捷键
79

810
## [[V0.2.1](https://github.com/QQxiaoming/quardCRT/releases/tag/V0.2.1)] - 2023-10-19
911

lib/qtermwidget/BlockArray.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ const Block * BlockArray::at(size_t i)
151151
}
152152

153153
// if (index - i >= length) {
154-
// kDebug(1211) << "BlockArray::at() index - i >= length\n";
155154
// return 0;
156155
// }
157156

@@ -201,8 +200,6 @@ bool BlockArray::setSize(size_t newsize)
201200

202201
bool BlockArray::setHistorySize(size_t newsize)
203202
{
204-
// kDebug(1211) << "setHistorySize " << size << " " << newsize;
205-
206203
if (size == newsize) {
207204
return false;
208205
}

lib/qtermwidget/CharacterColor.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
// Qt
2727
#include <QColor>
2828

29-
//#include <kdemacros.h>
30-
#define KDE_NO_EXPORT
31-
3229
namespace Konsole
3330
{
3431

@@ -108,7 +105,7 @@ class ColorEntry
108105
//a standard set of colors using black text on a white background.
109106
//defined in TerminalDisplay.cpp
110107

111-
extern const ColorEntry base_color_table[TABLE_COLORS] KDE_NO_EXPORT;
108+
extern const ColorEntry base_color_table[TABLE_COLORS];
112109

113110
/* CharacterColor is a union of the various color spaces.
114111

lib/qtermwidget/ColorScheme.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,6 @@
3434
#include <QRandomGenerator>
3535
#include <QStringView>
3636

37-
// KDE
38-
//#include <KColorScheme>
39-
//#include <KConfig>
40-
//#include <KLocale>
41-
//#include <KDebug>
42-
//#include <KConfigGroup>
43-
//#include <KStandardDirs>
44-
4537
using namespace Konsole;
4638

4739
const ColorEntry ColorScheme::defaultTable[TABLE_COLORS] =
@@ -521,18 +513,6 @@ QList<const ColorScheme*> ColorSchemeManager::allColorSchemes()
521513

522514
return _colorSchemes.values();
523515
}
524-
#if 0
525-
void ColorSchemeManager::addColorScheme(ColorScheme* scheme)
526-
{
527-
_colorSchemes.insert(scheme->name(),scheme);
528-
529-
// save changes to disk
530-
QString path = KGlobal::dirs()->saveLocation("data","konsole/") + scheme->name() + ".colorscheme";
531-
KConfig config(path , KConfig::NoGlobals);
532-
533-
scheme->write(config);
534-
}
535-
#endif
536516

537517
bool ColorSchemeManager::loadCustomColorScheme(const QString& path)
538518
{
@@ -619,7 +599,6 @@ bool ColorSchemeManager::deleteColorScheme(const QString& name)
619599
}
620600
QString ColorSchemeManager::findColorSchemePath(const QString& name) const
621601
{
622-
// QString path = KStandardDirs::locate("data","konsole/"+name+".colorscheme");
623602
const QStringList dirs = get_color_schemes_dirs();
624603
if ( dirs.isEmpty() )
625604
return QString();
@@ -629,7 +608,6 @@ QString ColorSchemeManager::findColorSchemePath(const QString& name) const
629608
if ( !path.isEmpty() )
630609
return path;
631610

632-
//path = KStandardDirs::locate("data","konsole/"+name+".schema");
633611
path = dir + QLatin1Char('/')+ name + QLatin1String(".schema");
634612

635613
return path;

lib/qtermwidget/ColorScheme.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,6 @@ class ColorSchemeManager
254254
*/
255255
const ColorScheme* findColorScheme(const QString& name);
256256

257-
#if 0
258-
/**
259-
* Adds a new color scheme to the manager. If @p scheme has the same name as
260-
* an existing color scheme, it replaces the existing scheme.
261-
*
262-
* TODO - Ensure the old color scheme gets deleted
263-
*/
264-
void addColorScheme(ColorScheme* scheme);
265-
#endif
266257
/**
267258
* Deletes a color scheme. Returns true on successful deletion or false otherwise.
268259
*/

lib/qtermwidget/ColorTables.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
#include "CharacterColor.h"
55

6-
//using namespace Konsole;
76
#if 0
7+
using namespace Konsole;
8+
89
static const ColorEntry whiteonblack_color_table[TABLE_COLORS] = {
910
// normal
1011
ColorEntry(QColor(0xFF,0xFF,0xFF), false ), ColorEntry( QColor(0x00,0x00,0x00), true ), // Dfore, Dback

lib/qtermwidget/Emulation.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,21 @@
1919
02110-1301 USA.
2020
*/
2121

22-
// Own
2322
#include "Emulation.h"
2423

25-
// System
2624
#include <cstdio>
2725
#include <cstdlib>
2826
#include <unistd.h>
2927
#include <string>
3028

31-
// Qt
3229
#include <QApplication>
3330
#include <QClipboard>
3431
#include <QHash>
3532
#include <QKeyEvent>
3633
#include <QTextStream>
3734
#include <QThread>
38-
3935
#include <QTime>
4036

41-
// KDE
42-
//#include <kdebug.h>
43-
44-
// Konsole
4537
#include "KeyboardTranslator.h"
4638
#include "Screen.h"
4739
#include "TerminalCharacterDecoder.h"

lib/qtermwidget/Filter.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,8 @@
3535
#include <QDesktopServices>
3636
#include <QUrl>
3737

38-
// KDE
39-
//#include <KLocale>
40-
//#include <KRun>
41-
42-
// Konsole
4338
#include "TerminalCharacterDecoder.h"
44-
#include "konsole_wcwidth.h"
39+
#include "console_charwidth.h"
4540

4641
using namespace Konsole;
4742

lib/qtermwidget/History.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,8 @@
3737

3838
#include <QtDebug>
3939

40-
// KDE
41-
//#include <kde_file.h>
42-
//#include <kdebug.h>
43-
4440
// Reasonable line size
4541
#define LINE_SIZE 1024
46-
#define KDE_lseek lseek
4742

4843
using namespace Konsole;
4944

@@ -164,7 +159,7 @@ void HistoryFile::add(const unsigned char* bytes, int len)
164159

165160
int rc = 0;
166161

167-
rc = KDE_lseek(ion,length,SEEK_SET); if (rc < 0) { perror("HistoryFile::add.seek"); return; }
162+
rc = lseek(ion,length,SEEK_SET); if (rc < 0) { perror("HistoryFile::add.seek"); return; }
168163
rc = write(ion,bytes,len); if (rc < 0) { perror("HistoryFile::add.write"); return; }
169164
length += rc;
170165
}
@@ -190,7 +185,7 @@ void HistoryFile::get(unsigned char* bytes, int len, int loc)
190185

191186
if (loc < 0 || len < 0 || loc + len > length)
192187
fprintf(stderr,"getHist(...,%d,%d): invalid args.\n",len,loc);
193-
rc = KDE_lseek(ion,loc,SEEK_SET); if (rc < 0) { perror("HistoryFile::get.seek"); return; }
188+
rc = lseek(ion,loc,SEEK_SET); if (rc < 0) { perror("HistoryFile::get.seek"); return; }
194189
rc = read(ion,bytes,len); if (rc < 0) { perror("HistoryFile::get.read"); return; }
195190
}
196191
}
@@ -367,7 +362,6 @@ bool HistoryScrollBuffer::isWrappedLine(int lineNumber)
367362

368363
if (lineNumber < _usedLines)
369364
{
370-
//kDebug() << "Line" << lineNumber << "wrapped is" << _wrappedLine[bufferIndex(lineNumber)];
371365
return _wrappedLine[bufferIndex(lineNumber)];
372366
}
373367
else
@@ -388,10 +382,6 @@ void HistoryScrollBuffer::getCells(int lineNumber, int startColumn, int count, C
388382

389383
const HistoryLine& line = _historyBuffer[bufferIndex(lineNumber)];
390384

391-
//kDebug() << "startCol " << startColumn;
392-
//kDebug() << "line.size() " << line.size();
393-
//kDebug() << "count " << count;
394-
395385
Q_ASSERT( startColumn <= line.size() - count );
396386

397387
memcpy(buffer, line.constData() + startColumn , count * sizeof(Character));
@@ -560,7 +550,6 @@ void* CompactHistoryBlock::allocate ( size_t length )
560550

561551
void* block = tail;
562552
tail += length;
563-
//kDebug() << "allocated " << length << " bytes at address " << block;
564553
allocCount++;
565554
return block;
566555
}
@@ -578,12 +567,10 @@ void* CompactHistoryBlockList::allocate(size_t size)
578567
{
579568
block = new CompactHistoryBlock();
580569
list.append ( block );
581-
//kDebug() << "new block created, remaining " << block->remaining() << "number of blocks=" << list.size();
582570
}
583571
else
584572
{
585573
block = list.last();
586-
//kDebug() << "old block used, remaining " << block->remaining();
587574
}
588575
return block->allocate(size);
589576
}
@@ -608,7 +595,6 @@ void CompactHistoryBlockList::deallocate(void* ptr)
608595
{
609596
list.removeAt(i);
610597
delete block;
611-
//kDebug() << "block deleted, new size = " << list.size();
612598
}
613599
}
614600

@@ -645,7 +631,6 @@ CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlo
645631
k++;
646632
}
647633

648-
//kDebug() << "number of different formats in string: " << formatLength;
649634
formatArray = (CharacterFormat*) blockList.allocate(sizeof(CharacterFormat)*formatLength);
650635
Q_ASSERT (formatArray!=nullptr);
651636
text = (quint16*) blockList.allocate(sizeof(quint16)*line.size());
@@ -668,7 +653,6 @@ CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlo
668653
c=line[k];
669654
formatArray[j].setFormat(c);
670655
formatArray[j].startPos=k;
671-
//kDebug() << "format entry " << j << " at pos " << formatArray[j].startPos << " " << &(formatArray[j].startPos) ;
672656
j++;
673657
}
674658
k++;
@@ -678,15 +662,12 @@ CompactHistoryLine::CompactHistoryLine ( const TextLine& line, CompactHistoryBlo
678662
for ( int i=0; i<line.size(); i++ )
679663
{
680664
text[i]=line[i].character;
681-
//kDebug() << "char " << i << " at mem " << &(text[i]);
682665
}
683666
}
684-
//kDebug() << "line created, length " << length << " at " << &(length);
685667
}
686668

687669
CompactHistoryLine::~CompactHistoryLine()
688670
{
689-
//kDebug() << "~CHL";
690671
if (length>0) {
691672
blockList.deallocate(text);
692673
blockList.deallocate(formatArray);
@@ -723,7 +704,6 @@ CompactHistoryScroll::CompactHistoryScroll ( unsigned int maxLineCount )
723704
,lines()
724705
,blockList()
725706
{
726-
//kDebug() << "scroll of length " << maxLineCount << " created";
727707
setMaxNbLines ( maxLineCount );
728708
}
729709

@@ -755,7 +735,6 @@ void CompactHistoryScroll::addCells ( const Character a[], int count )
755735
void CompactHistoryScroll::addLine ( bool previousWrapped )
756736
{
757737
CompactHistoryLine *line = lines.last();
758-
//kDebug() << "last line at address " << line;
759738
line->setWrapped(previousWrapped);
760739
}
761740

@@ -768,7 +747,6 @@ int CompactHistoryScroll::getLineLen ( int lineNumber )
768747
{
769748
Q_ASSERT ( lineNumber >= 0 && lineNumber < lines.size() );
770749
CompactHistoryLine* line = lines[lineNumber];
771-
//kDebug() << "request for line at address " << line;
772750
return line->getLength();
773751
}
774752

@@ -790,7 +768,6 @@ void CompactHistoryScroll::setMaxNbLines ( unsigned int lineCount )
790768
while (lines.size() > (int) lineCount) {
791769
delete lines.takeAt(0);
792770
}
793-
//kDebug() << "set max lines to: " << _maxLineCount;
794771
}
795772

796773
bool CompactHistoryScroll::isWrappedLine ( int lineNumber )

lib/qtermwidget/History.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,9 @@
2727
#include <QVector>
2828
#include <QTemporaryFile>
2929

30-
// KDE
31-
//#include <ktemporaryfile.h>
32-
33-
// Konsole
3430
#include "BlockArray.h"
3531
#include "Character.h"
3632

37-
// map
3833
#if defined(Q_OS_WIN)
3934
#include <windows.h>
4035
#else

lib/qtermwidget/KeyboardTranslator.cpp

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@
3838

3939
#include "tools.h"
4040

41-
// KDE
42-
//#include <KDebug>
43-
//#include <KLocale>
44-
//#include <KStandardDirs>
45-
4641
using namespace Konsole;
4742

4843

@@ -69,7 +64,6 @@ KeyboardTranslatorManager::~KeyboardTranslatorManager()
6964
QString KeyboardTranslatorManager::findTranslatorPath(const QString& name)
7065
{
7166
return QString(get_kb_layout_dir() + name + QLatin1String(".keytab"));
72-
//return KGlobal::dirs()->findResource("data","konsole/"+name+".keytab");
7367
}
7468

7569
void KeyboardTranslatorManager::findTranslators()
@@ -79,9 +73,6 @@ void KeyboardTranslatorManager::findTranslators()
7973
filters << QLatin1String("*.keytab");
8074
dir.setNameFilters(filters);
8175
QStringList list = dir.entryList(filters);
82-
// QStringList list = KGlobal::dirs()->findAllResources("data",
83-
// "konsole/*.keytab",
84-
// KStandardDirs::NoDuplicates);
8576

8677
// add the name of each translator to the list and associated
8778
// the name with a null pointer to indicate that the translator
@@ -120,33 +111,8 @@ const KeyboardTranslator* KeyboardTranslatorManager::findTranslator(const QStrin
120111

121112
bool KeyboardTranslatorManager::saveTranslator(const KeyboardTranslator* translator)
122113
{
123-
qDebug() << "KeyboardTranslatorManager::saveTranslator" << "unimplemented";
124-
Q_UNUSED(translator);
125-
#if 0
126-
const QString path = KGlobal::dirs()->saveLocation("data","konsole/")+translator->name()
127-
+".keytab";
128-
129-
//kDebug() << "Saving translator to" << path;
130-
131-
QFile destination(path);
132-
if (!destination.open(QIODevice::WriteOnly | QIODevice::Text))
133-
{
134-
qDebug() << "Unable to save keyboard translation:"
135-
<< destination.errorString();
136-
return false;
137-
}
138-
139-
{
140-
KeyboardTranslatorWriter writer(&destination);
141-
writer.writeHeader(translator->description());
142-
143-
QListIterator<KeyboardTranslator::Entry> iter(translator->entries());
144-
while ( iter.hasNext() )
145-
writer.writeEntry(iter.next());
146-
}
147-
148-
destination.close();
149-
#endif
114+
qDebug() << "KeyboardTranslatorManager::saveTranslator" << "unimplemented";
115+
Q_UNUSED(translator);
150116
return true;
151117
}
152118

0 commit comments

Comments
 (0)