@@ -29,16 +29,33 @@ NXMUrl::NXMUrl(const QString& url)
2929{
3030 QUrl nxm (url);
3131 QUrlQuery query (nxm);
32- QRegularExpression exp (" nxm://[a-z0-9]+/mods/(\\ d+)/files/(\\ d+)" ,
33- QRegularExpression::CaseInsensitiveOption);
34- auto match = exp.match (url);
32+ // nxm://starfield/collections/7ou329/revisions/24
33+ QRegularExpression modsExp (" nxm://[a-z0-9]+/mods/(\\ d+)/files/(\\ d+)" ,
34+ QRegularExpression::CaseInsensitiveOption);
35+ QRegularExpression collectionsExp (
36+ " nxm://[a-z0-9]+/collections/([a-z0-9]+)/revisions/(\\ d+)" ,
37+ QRegularExpression::CaseInsensitiveOption);
38+ auto match = modsExp.match (url);
39+ bool collectionsLink = false ;
3540 if (!match.hasMatch ()) {
36- throw MOBase::InvalidNXMLinkException (url);
41+ match = collectionsExp.match (url);
42+ if (!match.hasMatch ()) {
43+ throw MOBase::InvalidNXMLinkException (url);
44+ } else {
45+ collectionsLink = true ;
46+ }
47+ }
48+ m_Game = nxm.host ();
49+ if (!collectionsLink) {
50+ m_ModId = match.captured (1 ).toInt ();
51+ m_FileId = match.captured (2 ).toInt ();
52+ m_Key = query.queryItemValue (" key" );
53+ m_Expires = query.queryItemValue (" expires" ).toInt ();
54+ m_UserId = query.queryItemValue (" user_id" ).toInt ();
55+ m_Collection = false ;
56+ } else {
57+ m_CollectionId = match.captured (1 );
58+ m_CollectionRevision = match.captured (2 ).toInt ();
59+ m_Collection = true ;
3760 }
38- m_Game = nxm.host ();
39- m_ModId = match.captured (1 ).toInt ();
40- m_FileId = match.captured (2 ).toInt ();
41- m_Key = query.queryItemValue (" key" );
42- m_Expires = query.queryItemValue (" expires" ).toInt ();
43- m_UserId = query.queryItemValue (" user_id" ).toInt ();
4461}
0 commit comments