File tree Expand file tree Collapse file tree 1 file changed +24
-34
lines changed
Expand file tree Collapse file tree 1 file changed +24
-34
lines changed Original file line number Diff line number Diff line change @@ -82,47 +82,37 @@ namespace
8282 }
8383}
8484
85- #if defined(_MSC_VER) || defined(__MINGW32__)
86- QString AppendExtensionForFileDialog (QString fileName, QString selectedFilter)
87- {
88- (void )selectedFilter;
85+ QString AppendExtensionForFileDialog (QString fileName, QString selectedFilter)
86+ {
87+ if (selectedFilter.isEmpty ())
8988 return fileName;
90- }
91- #endif
9289
93- #if defined(unix) || defined(__unix__) || defined(__unix) || defined(__APPLE__)
94- QString AppendExtensionForFileDialog (QString fileName, QString selectedFilter)
90+ struct Filter2Ext
9591 {
96- if (selectedFilter.isEmpty ())
97- return fileName;
98-
99- struct Filter2Ext
100- {
101- const char *filter;
102- const char *ext;
103- };
104-
105- static Filter2Ext tbl[] =
106- {
107- {" (*.epd)" , " .epd" },
108- {" (*.gpg)" , " .gpg" },
109- {" (*.asc)" , " .asc" },
110- {" (*.txt)" , " .txt" },
111- {" (*.key)" , " .key" },
112- {nullptr , nullptr },
113- };
92+ const char *filter;
93+ const char *ext;
94+ };
11495
115- Filter2Ext *p = tbl;
96+ static Filter2Ext tbl[] =
97+ {
98+ {" (*.epd)" , " .epd" },
99+ {" (*.gpg)" , " .gpg" },
100+ {" (*.asc)" , " .asc" },
101+ {" (*.txt)" , " .txt" },
102+ {" (*.key)" , " .key" },
103+ {nullptr , nullptr },
104+ };
116105
117- for (;p->ext != nullptr ; p++)
118- {
119- if (selectedFilter.endsWith (QString (p->filter )) && !fileName.toLower ().endsWith (p->ext ))
120- fileName += p->ext ;
121- }
106+ Filter2Ext *p = tbl;
122107
123- return fileName;
108+ for (;p->ext != nullptr ; p++)
109+ {
110+ if (selectedFilter.endsWith (QString (p->filter )) && !fileName.toLower ().endsWith (p->ext ))
111+ fileName += p->ext ;
124112 }
125- #endif
113+
114+ return fileName;
115+ }
126116
127117
128118QString GetSaveDialogFilter ()
You can’t perform that action at this time.
0 commit comments