MCPcopy Create free account
hub / github.com/cxasm/notepad-- / initFindWindow

Method initFindWindow

src/cceditor/ccnotepad.cpp:6862–6996  ·  view source on GitHub ↗

返回值:0 正常 1 选择自动为空

Source from the content-addressed store, hash-verified

6860
6861//返回值:0 正常 1 选择自动为空
6862int CCNotePad::initFindWindow(FindTabIndex type)
6863{
6864 int ret = 0;
6865 FindWin* pFind = nullptr;
6866 QWidget* pw = ui.editTabWidget->currentWidget();
6867 int docType = getDocTypeProperty(pw);
6868
6869 if (m_pFindWin.isNull())
6870 {
6871 m_pFindWin = new FindWin(this);
6872 connect(m_pFindWin,&QObject::destroyed,this,&CCNotePad::slot_saveSearchHistory);
6873
6874 QByteArray lastGeo = NddSetting::getKeyByteArrayValue(FINDWINSIZE);
6875
6876 if (!lastGeo.isEmpty())
6877 {
6878 m_pFindWin->restoreGeometry(lastGeo);
6879 }
6880
6881 pFind = dynamic_cast<FindWin*>(m_pFindWin.data());
6882
6883 if (s_findHistroy.isEmpty())
6884 {
6885 //从历史查找记录文件中加载
6886 QString searchHistory = QString("notepad/searchHistory");//历史查找记录
6887 QSettings qs(QSettings::IniFormat, QSettings::UserScope, searchHistory);
6888 qs.setIniCodec("UTF-8");
6889
6890 if (qs.contains("keys"))
6891 {
6892 QVariant history = qs.value("keys", "");
6893 s_findHistroy = history.toStringList();
6894 }
6895 if (qs.contains("replace"))
6896 {
6897 QVariant replaceHistory = qs.value("replace", "");
6898 s_replaceHistroy = replaceHistory.toStringList();
6899 }
6900 }
6901
6902 pFind->setFindHistory(&s_findHistroy);
6903 pFind->setReplaceHistory(&s_replaceHistroy);
6904
6905 pFind->setTabWidget(ui.editTabWidget);
6906
6907 if((TXT_TYPE == docType) || (BIG_TEXT_RO_TYPE == docType) || (SUPER_BIG_TEXT_RO_TYPE == docType))
6908 {
6909 //connect(pFind, &FindWin::sign_findAllInCurDoc, this, &CCNotePad::slot_showFindAllInCurDocResult);
6910 connect(pFind, &FindWin::sign_findAllInOpenDoc, this, &CCNotePad::slot_showfindAllInOpenDocResult);
6911 connect(pFind, &FindWin::sign_replaceSaveFile, this, &CCNotePad::slot_saveFile);
6912 connect(pFind, &FindWin::sign_clearResult, this, &CCNotePad::slot_clearFindResult);
6913 }
6914 else
6915 {
6916 //二进制DOC只读,不许替换编辑。不在这里做,会导致编辑框回调。在FindWin里面去判断
6917 //pFind->disableReplace();
6918 }
6919 //注册一个ESC的退出按钮事件

Callers

nothing calls this directly

Calls 15

getDocTypePropertyFunction · 0.85
isEmptyMethod · 0.80
dataMethod · 0.80
setReplaceHistoryMethod · 0.80
setKeyMethod · 0.80
closeMethod · 0.80
selectedTextMethod · 0.80
keywordWinGetFouseMethod · 0.80
setReplaceFindTextMethod · 0.80
setDirFindTextMethod · 0.80
setMarkFindTextMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected