Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
psemiletov committed Dec 25, 2024
1 parent e16c298 commit 65976bf
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 25 deletions.
3 changes: 2 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
epub снова не читается
при загрузке форматов "только на чтение" проблемы с последующей загрузкой из Recent, открываются другие документы, хотя в статус баре правильное имя файла


после изменения порядка табов, для функции статистики текст выделения берется всё еще "по прежнему месту"

Expand Down
26 changes: 15 additions & 11 deletions src/document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1425,11 +1425,11 @@ QMenu* CDocument::createStandardContextMenu()

bool CDocument::file_open (const QString &fileName, const QString &codec)
{
//qDebug() << "CDocument::file_open " << fileName;
qDebug() << "CDocument::file_open " << fileName;

CTio *tio = holder->tio_handler.get_for_fname (fileName);

//qDebug() << "tio->metaObject()->className()" << tio->metaObject()->className();
qDebug() << "tio->metaObject()->className()" << tio->metaObject()->className();

if (! tio)
return false;
Expand Down Expand Up @@ -2606,9 +2606,9 @@ void CDox::add_to_recent (CDocument *d)
s += "*";

if (! d->get_word_wrap())
s+="0";
s+= "0";
else
s+="1";
s+= "1";

recent_files.prepend (s);
if (recent_files.size() > recent_list_max_items)
Expand Down Expand Up @@ -2948,16 +2948,20 @@ void CDox::open_recent()
{
QAction *act = qobject_cast<QAction *>(sender());

QString t = act->text();
t.remove ("&");
//QString t = act->text();
QString t = act->data().toString();

//qDebug() << "t:" << t;
//t.remove ("&");

int i = recent_files.indexOf (t);
if (i == -1)
return;
qDebug() << "t:" << t;

// int i = recent_files.indexOf (t);
// if (i == -1)
// return;

// CDocument *d = open_file_triplex (recent_files[i]);
CDocument *d = open_file_triplex (t);

CDocument *d = open_file_triplex (recent_files[i]);
if (d)
dir_last = get_file_path (d->file_name);

Expand Down
7 changes: 7 additions & 0 deletions src/gui_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,22 @@ void create_menu_from_list (QObject *handler,
{
menu->setTearOffEnabled (true);

// qDebug() << "=========== create_menu_from_list START=========";

for (QList <QString>::const_iterator i = list.begin(); i != list.end(); ++i)
{
if (! i->startsWith ("#"))
{
// qDebug() << "*i" << *i;

QAction *act = menu->addAction (*i);
act->setData (*i);
handler->connect (act, SIGNAL(triggered()), handler, method);
}
}

//qDebug() << "=========== create_menu_from_list END=========";

}


Expand Down
1 change: 1 addition & 0 deletions src/tea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ C++/Qt branch started at 08 November 2007
#include <cstdlib>


//ВОТ ЭТО НИЖЕ ВСПОМНИТЬ
#if QT_VERSION >= 0x050000
#include <QRegularExpression>
#else
Expand Down
23 changes: 10 additions & 13 deletions src/tio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,6 @@ std::vector <std::string> split_string_to_vector (const string& s, const string&
}




//from https://stackoverflow.com/questions/13739924/remove-all-xml-tags-from-a-stdstring
std::string xml_strip(std::string &xmlBuffer)
{
Expand Down Expand Up @@ -260,9 +258,7 @@ std::string xml_strip_remove_empty_lines (std::string &xmlBuffer)
return join_lines (v, "\n");

//str.find_first_not_of(" \t\n\v\f\r") != std::string::npos




}


Expand Down Expand Up @@ -424,7 +420,7 @@ bool CTioPlainText::load (const QString &fname)

QByteArray ba = file.readAll();

qDebug() << "charset:" << charset;
//qDebug() << "charset:" << charset;

//ok
if (charset == "UTF-8")
Expand Down Expand Up @@ -585,6 +581,8 @@ CTio* CTioHandler::get_for_fname (const QString &fname)
{
CTio *instance = 0;

//с нуля лишего смысла, ибо list[0] содержит умолчальный обработчик
//в котором не создан список расширений файлов для обработки
for (vector <size_t>::size_type i = 0; i < list.size(); i++)
{
instance = list.at (i);
Expand Down Expand Up @@ -1646,7 +1644,7 @@ std::vector <std::string> extract_src_from_toc (const std::string &source, const

std::string url = source.substr (pos_start + signature_size, pos_end - (pos_start + signature_size));

qDebug() << "url:" << url;
// qDebug() << "url:" << url;

//find "#" if any
//remove after # to the end of string
Expand Down Expand Up @@ -1731,7 +1729,6 @@ bool CTioEpub::load (const QString &fn)
if (bufsize == 0)
return false;



// done with toc
std::string content ((char*)toc);
Expand All @@ -1744,7 +1741,7 @@ bool CTioEpub::load (const QString &fn)

//HERE WE ALREADY PARSED URLS

qDebug() << "urls.size(): " << urls.size();
// qDebug() << "urls.size(): " << urls.size();


if (urls.size() == 0)
Expand All @@ -1763,7 +1760,7 @@ bool CTioEpub::load (const QString &fn)
if (urls[i] == urls[i+1])
continue;

qDebug() << "i: " << i;
// qDebug() << "i: " << i;


// std::cout << "open: " << urls[i] << std::endl;
Expand All @@ -1772,13 +1769,13 @@ bool CTioEpub::load (const QString &fn)

if (zip_entry_open (zip, urls[i].c_str()) >= 0)
{
qDebug() << "opened " << urls[i].c_str();
// qDebug() << "opened " << urls[i].c_str();


zip_entry_read (zip, &temp, &bufsize);
zip_entry_close (zip);

qDebug() << "readed and closed";
// qDebug() << "readed and closed";

std::string st;

Expand All @@ -1801,7 +1798,7 @@ bool CTioEpub::load (const QString &fn)
// st_cleaned = html_strip (st);


qDebug() << "cleanded";
// qDebug() << "cleanded";


//print_lines (file_lines);
Expand Down

0 comments on commit 65976bf

Please sign in to comment.